method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3c3adc15-267e-4941-a4a6-5609d112e451 | 4 | public String toString(){
int dollars = this.Dollars;
int cents = this.Cents;
String printedMoney = new String();
if(cents < 10 && cents >= 0){
printedMoney = dollars + ".0" + cents;
}
else if(cents >= 10){
printedMoney = dollars + "." + cents;
}
else if(cents < 0){
printedMoney = "-" + doll... |
9d0334e9-2ccd-4337-82c8-eaef945b0262 | 3 | public boolean sendMessage(byte[] message) {
try {
to_peer.write(message);
lastMessageSent = System.nanoTime();
to_peer.flush();
if(errorCount > 0)
errorCount--;
} catch (IOException e) {
System.err.println("Error sending message: " + message.toString() +
"/nto peer located at: " + ip);
e... |
b971594a-0dfb-4f50-b7f1-989b589944d1 | 1 | private void fireBitfieldAvailabity() {
for (PeerActivityListener listener : this.listeners) {
listener.handleBitfieldAvailability(this,
this.getAvailablePieces());
}
} |
f4080c87-2a92-4cd5-b471-937d0c32cf34 | 7 | private static void testInvalidNode(ListNode p) {
System.out.println("p.isValidNode() should be false: " + p.isValidNode());
try {
p.item();
System.out.println("p.item() should throw an exception, but didn't.");
} catch (InvalidNodeException lbe) {
System.out.println("p.item() should throw... |
f635c726-4721-4501-b588-ef64209f8ab1 | 9 | public static <T extends Comparable<T>, E> int height(Node<T,E> node){
int height = 0;
if(node==null){
height = 0;
} else if(node.getLeftNode()== null && node.getRightNode()== null){
height = 1;
} else if(node.getLeftNode()!= null && node.getRightNode()== null){
height =1 + height(node.getLeftNode()... |
435b357a-d993-4e9f-99e0-2b649a8fdb9e | 9 | private void calculateUpperTotal() {
int upperSupTotal = 0;
for (ScoreCardCategories d: ScoreCardCategories.values()) {
if (d==ScoreCardCategories.ONES || d==ScoreCardCategories.TWOS || d==ScoreCardCategories.THREES ||d == ScoreCardCategories.FOURS || d==ScoreCardCategories.FIVES || d==ScoreCardCategories.SIX... |
e1e59a1a-b15c-4571-986b-2f16d0c9e0b3 | 8 | private void updateFacingDirection(Entity entity) {
if (entity.tickEnd == tick
|| entity.animation == -1
|| entity.animationDelay != 0
|| entity.currentAnimationDuration + 1 > AnimationSequence.animations[entity.animation]
.getFrameLength(entity.currentAnimationFrame)) {
int duration = entity.tic... |
84a50dd0-d9fe-4989-bf36-d3dd27d3e3bc | 6 | public List<String> getValidationErrors() {
List<String> errors = new ArrayList<String>();
if(button != null && button.equals("Add Favorite")) {
if (url == null || url.length() == 0) {
errors.add("Url is required");
}
if (comments == null || comments.length() ==0 ) {
errors.add("comments is requir... |
e1d5d221-3cf6-407a-a457-aa5043b87525 | 1 | public void remove(int index) {
RangeCheck(index);
int numMoved = size - index - 1;
if (numMoved > 0) {
System.arraycopy(attributeLists, index + 1, attributeLists, index, numMoved);
}
attributeLists[--size] = null;
} |
076548f3-5abb-4e73-a04f-b034f046f873 | 1 | @Override
public void mouseMove(MouseEvent e) {
if(this.getMouseListener() != null)
{
this.getMouseListener().MouseMove(this, e);
}
} |
a6f0a539-f9a2-4fed-84de-b853cfa4282c | 7 | public boolean checkGuess(Guess g) {
int x = g.get_X();
int y = g.get_Y();
int l = this.ships.size();
boolean hit = false;
boolean sunk = true;
int i = 0;
while(!hit && i<l){
hit = this.ships.get(i).testHit(x, y);
if(hit && (this.returnCharacter(y, x) != Grid.HIT)) {
this.board[y][x] = Grid.HI... |
b716e867-5f66-4650-8c9e-85a585281c76 | 6 | @Override
public void sequence(String id, String sequence, String quality) {
int cutIndex = sequence.length();
if (qdecoder != null) {
int qual[] = null;
try {
qual = qdecoder.decodeQuality(quality);
} catch (QualityFormatException e1) {
String error = String.format(
"Quality encoding is no... |
78ed7e70-4dd5-4647-ab72-ae767985ee17 | 2 | public void disable() throws IOException {
// This has to be synchronized or it can collide with the check in the task.
synchronized (optOutLock) {
// Check if the server owner has already set opt-out, if not, set it.
if (!isOptOut()) {
configuration.set("opt-out"... |
586d18d6-12b2-4d2e-a231-6a81688a62c9 | 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 fe... |
f8f64ed0-0717-40f7-9f3f-9b4d5a281d5d | 1 | public void delete(Member persistentInstance) {
log.debug("deleting Member instance");
try {
Session session = getSession();
Transaction tr = session.beginTransaction();
session.delete(persistentInstance);
tr.commit();
session.flush();
session.close();
log.debug("delete successful");
} catch ... |
25b34924-a96b-4126-8b03-19956bef25ce | 7 | public boolean isServerPath(String name)
{
name=name.replace('/','.');
while(name.startsWith("."))
name=name.substring(1);
String[] server_classes=_context.getServerClasses();
if (server_classes!=null)
{
for (int i=0;i<server_classes.length;i... |
9cfa9ba6-5427-487f-99df-a39bc6997d47 | 4 | private static boolean getNewScheduled(HashMap<String, Object> map) {
Object self = map.get("selfStudy");
if (self != null)
return !(Boolean) self;
Object type = map.get("courseType");
if ("v1.session".equals(type) || "v1.capstone".equals(type))
return true;
if ("v2.ondemand".equals(type))
return fal... |
8296104e-f523-4fc4-850c-c9f7153baf81 | 2 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jFormatt... |
fcdb77ae-e3d4-49bd-b088-16400994996f | 7 | public void renderTile(int xp, int yp, Tile tile) {
xp -= xOffset;
yp -= yOffset;
for(int y = 0; y < tile.sprite.SIZE; y++) {
int ya = y + yp;
for(int x = 0; x < tile.sprite.SIZE; x++) {
int xa = x + xp;
if (xa < -tile.sprite.SIZE || xa >= width || ya < 0 || ya >= height) break;
if(xa < 0) xa = ... |
0ab26022-7515-4258-8d52-e8112c599cdf | 9 | private double[][] computeBlendWeights()
{
int width = m_lic.getTextureSize().width;
int height = m_lic.getTextureSize().height;
double[][] weights = new double[width][height];
//generate texture containg weights
PdVector[] verts = m_domain.getVertices();
for(int i = 0; i < m_domain.getNumElements(); i+... |
029b743d-2230-411f-a061-b394ce428172 | 0 | @Basic
@Column(name = "FUN_UNIDAD")
public String getFunUnidad() {
return funUnidad;
} |
3f6caf5d-f56c-41a3-a4ee-dc287cd9b930 | 9 | @Override
public void buttonClicked(JButton button)
{
if (button == cancel)
{
for (PieceSelection ps : types)
ps.isSelected = true;
onlyLockedLayer.setSelected(false);
setVisible(false);
}
else if (button == execute)
{
Set<PieceType> set = new HashSe... |
b14894bd-163a-4530-9ff9-62c074c71610 | 8 | public void initialize() throws SyslogRuntimeException {
super.initialize();
final SSLTCPNetSyslogServerConfigIF sslTcpNetSyslogServerConfig = (SSLTCPNetSyslogServerConfigIF) this.tcpNetSyslogServerConfig;
final String keyStore = sslTcpNetSyslogServerConfig.getKeyStore();
if (keyStore != null && !"".equals(ke... |
cb71b959-739b-41c0-9a6a-87d39ee85dc0 | 6 | public void unDisplay(){
if (Debug.video) System.out.println("VideoPlayer -> undisplay called");
// Sets it to false
super.setIsActive(false);
realizeComplete = false;
if (null != player){
// Make sure that the program does not get stuck in video fullscreen mode.
if (Gui.isVideoFullScreenOn()){
go... |
f4246566-973b-4e51-9f29-6bf075f454bd | 9 | private void formShow() {
List<String> matchList = new ArrayList<String>();
Team homeTeam, awayTeam;
int homeScore, awayScore;
int nofMatches;
if (round <= modus.getNofRounds()) {
// regular season
nextRoundLabel.setText("Regular Round " + round);
nofMatches = ((modus.getNofTeams() % 2 == 0) ? modus.... |
d3cc92c7-3db2-4257-9d43-5445fd060db3 | 0 | public DataManager(TotalPermissions p, DataHolder< PermissionBase> holder) {
dataHolder = holder;
plugin = p;
} |
efe1314b-6612-4bf7-b848-282fee1006c3 | 6 | @Override
public void actionPerformed(ActionEvent e) {
if( e.getSource() == boton_alta_cliente ){
Controlador.getInstance().accion(EventoNegocio.GUI_ALTA_CLIENTE,GUIPrincipal_Cliente.this);
}
else if( e.getSource() == boton_baja_cliente){
... |
fc891cae-a1d5-4772-b25b-d03e89a4e7ee | 8 | public JsonObject newActivity( JsonObject json ) {
// Get and validate parameters
JsonValue activityJsonValue = json.get("activity");
if ( activityJsonValue == null ) return new JsonObject().add("error", "Parameter activity is null");
if ( !activityJsonValue.isObject() ) return new JsonObject().add("error", ... |
8b297022-719c-4e08-94a1-afc4a1b6ad42 | 1 | public Item removeAfter(DNode<Item> nd)
{
if (nd.next == head)
return null;
return remove(nd.next);
} |
a331c38a-2274-4f9e-ad91-5ffb9f044e01 | 6 | @Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof IList<?>))
return false;
IList<T> otherList = (IList<T>) o;
if (this.length() != otherList.length()) {
return false;
}
for (int i = 0; i < this.length(); i++)
if (!this.get(i).equals(otherList.get(i))... |
6bc2301f-a5af-487b-832d-e3e92b36e741 | 5 | public void checarCEPZipCode(String num){
if(num.length() != 10){
System.out.println("invalido");
return;
}
if(!(num.contains("-"))){
System.out.println("invalido");
return;
}
String parte1 = num.substring(0, 5);
String digito = num.substring(5, 6);
String parte2 = num.substring(6, 10);
if... |
501d7f4a-efb0-41b6-9992-c13f34f4b361 | 1 | public Admin validateAndConvert() throws ValidointiPoikkeus, InvalidAdminPoikkeus,
NoSuchAlgorithmException, UnsupportedEncodingException{
Validator validator = new Validator();
validator.validateUsername(username, "username", 3, 20);
validator.validatePassword(password1, password2, "password1", "password... |
5950cae6-ad5e-49b1-a780-42c9ecd90427 | 0 | @Override
public void win(GameEvent event) {
endGame("Gewonnen", event.getPoints());
} |
3881e078-089c-4401-865a-d9b8c749063e | 7 | public final void or_test() throws RecognitionException {
try {
// Python.g:292:9: ( and_test ( OR and_test )* )
// Python.g:292:11: and_test ( OR and_test )*
{
pushFollow(FOLLOW_and_test_in_or_test2363);
and_test();
state._fsp--;
if (state.failed) return;
// Python.g:292:20: ( OR and_test )*
... |
a0731400-40b2-478a-ba90-ef13d45103f5 | 1 | public void closeAfter2sec()
{
Thread t = new Thread(new Runnable() {
public void run() {
try {
Thread.sleep(3000);
setVisible(false);
} catch(InterruptedException e)... |
d2d41947-266b-47b0-b589-d2f0de8e881f | 3 | public static String[] search(String[][] clientArray, String queryString) {
for(String[] client: clientArray) {
if(client[1].toLowerCase().indexOf(queryString.toLowerCase())!=-1 ||
client[2].toLowerCase().indexOf(queryString.toLowerCase())!=-1) {
return client;
... |
d68350ae-c0d9-49cc-832b-243396b3baf1 | 4 | public void insertMod(String name, Iterable<String> parts) {
Iterator<String> partIterator = parts.iterator();
try {
while (partIterator.hasNext()) {
for (int i = 0; i < BATCH_SIZE && partIterator.hasNext(); i++) {
String part = partIterator.next();
insertPartStatement.setString(1, name);
... |
ac1698ba-caf6-4b64-9ef6-45b8decf1242 | 9 | public void write (Kryo kryo, Output output, Map map) {
int length = map.size();
output.writeInt(length, true);
Serializer keySerializer = this.keySerializer;
if (keyGenericType != null) {
if (keySerializer == null) keySerializer = kryo.getSerializer(keyGenericType);
keyGenericType = null;
}
Serializ... |
1630eaf0-84f2-45d2-907f-b3282efb460b | 0 | @Test
public void testMinus(){
//ReversePolishNotationCalculator calculator = new ReversePolishNotationCalculator();
calculator.pushOperand(3);
calculator.pushOperand(2.0);
System.out.println(calculator.operandsToString());
calculator.pushMinusOperator();
System.out.println(calculator.operatorsToString());... |
b4cef8e4-a7b4-40d3-b0fb-3d69a82dd238 | 7 | private void processDeleteReplica(Sim_event ev)
{
if (ev == null) {
return;
}
Object[] obj = (Object[]) ev.get_data();
if (obj == null)
{
System.out.println(super.get_name() +
".processDeleteReplica(): no object is found");
... |
72919a9a-726c-4c79-8e90-c1c6757bed6a | 2 | public Person(String n) {
name = n;
count = 0;
personMap.put(name,this);
if (maxNameLength < name.length())
maxNameLength = name.length();
nameParts = new HashSet();
StringTokenizer st = new StringTokenizer(name," -");
while (st.hasMoreTokens()) {
... |
4335b44a-0520-4d62-a5d8-61fd74933365 | 3 | @Override
public Fornecedor ListById(int id_fornecedor) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
Fornecedor f = new Fornecedor();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LISTBYID)... |
741a17c2-07f6-41ec-a33b-736fa4cad427 | 2 | public Position getNextWaypoint(){
if(points.size() <= nextWaypointNumber || nextWaypointNumber<0)
return points.getLast();
return points.get(nextWaypointNumber);
} |
b07869b3-e4a6-4958-9f22-8f2138b972c9 | 6 | @Override
public void validate() {
if (campaignname == null) {
addActionError("Please Enter Campaign Name");
}
if (dailybdgt == null) {
addActionError("Please Enter Daily Budget");
}
if (deliverytype == null) {
addActionError("Please S... |
0ac35234-c9aa-43ea-a415-c267dd62240d | 1 | private String GetMovieData(String link) throws Exception {
MovieData data = new MovieData();
data.link_csfd = link;
LoadMovieData(data);
if (data.link_imdb != null)
LoadImdbData(data);
return data.toString();
} |
34bce45d-c283-4a58-b2ea-26d08e9ecd34 | 7 | protected void beforeTag(final char c)
{
switch(c)
{
case ' ': case '\t': case '\r': case '\n': bufDex++; return;
case '<': changeTagState(State.BEFORETAG); return;
case '/': changedTagState(State.BEFORECLOSETAG); return;
default:
if(Character.isLetter(c))
changedTagState(State.INTAG);
else
c... |
a5a4180b-bc3f-4f63-9217-cd4a4e03e2ad | 2 | public String getNextType(){
if (level == 1){
return "Artillery";
}else if (level == 2){
return "Laser";
}else{
return "";
}
} |
cc0d0d66-9e06-4402-88dd-6761effc2af3 | 4 | public void query(List<Citation> citations) {
String option;
while (true) {
option = io.getString("Do you want to make a BibTex file (file) or print it on screen (screen)?: ");
if (option.equalsIgnoreCase("file") || option.equalsIgnoreCase("screen")) {
break;
... |
11dab1fe-fcb0-4f6c-8f2c-589c1e0e7cb6 | 2 | public static void beginLoop(){
while(StateHandler.close == false && DisplayHandler.closed() == false){
StateHandler.loop();
}
StateHandler.close();
AudioManager.close();
DisplayHandler.destroy();
OutputUtility.outputLine("-Process finished with no errors-");
... |
328b1390-1f92-42d6-b048-73d460f34543 | 7 | public void loadModels() {
ModelList.SortedListModel dataModel = ((ModelList.SortedListModel) m_ModelList.getModel());
int directoryCount = 0;
int modelCount = 0;
dataModel.clear();
File directory = m_Library.getWorkingDirectory();
File subDirectories[] = directory.listFiles(... |
b963b98f-688f-4640-ab8a-cecb65219f65 | 9 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(affected==null)
return false;
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if(mob.location().fetchEffect(ID())==null)
unInvoke();
}
else
if(affected instanceof Roo... |
5a2bf4df-972c-40bb-9b16-938265904761 | 4 | @Override
public void draw() {
mainOptions.draw();
if(newSave != null)
newSave.draw();
if(fieldSave != null)
fieldSave.draw();
if(saveList != null)
saveList.draw();
if(loadConfirm != null)
loadConfirm.draw();
} |
05d340f3-8dfc-40cb-9b69-2efb7359f248 | 8 | public static Matrix read (BufferedReader input) throws java.io.IOException {
StreamTokenizer tokenizer= new StreamTokenizer(input);
// Although StreamTokenizer will parse numbers, it doesn't recognize
// scientific notation (E or D); however, Double.valueOf does.
// The strategy here is to dis... |
47af8ae3-2645-494a-af19-c72a8afa5f35 | 5 | public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
if ((par5Entity.ridingEntity == null) && (par5Entity.riddenByEntity == null) && ((par5Entity instanceof EntityPlayerMP)))
{
EntityPlayerMP player = (EntityPlayerMP) par5E... |
2b88600c-965c-4d07-850c-99f810272764 | 0 | public static void main(String[] args) {
System.out.println(true); // true
System.out.println(false); // false
System.out.println(1 < 2); // true
System.out.println('A' == 'B'); // false
} |
5cc7d174-e232-497d-b1c2-ace2b9a917f3 | 0 | public void sendToMaxSolutions(int maxNumberOfSolutions) {
OSCMessage message1 = new OSCMessage("/ch/maxsolutions");
message1.addArgument(maxNumberOfSolutions);
send(message1);
} |
37c1dd53-70c9-48c5-ac49-1c4a5a967a2b | 8 | ReadPreference getCommandReadPreference(DBObject command, ReadPreference requestedPreference){
if (_mongo.getReplicaSetStatus() == null) {
return requestedPreference;
}
String comString = command.keySet().iterator().next();
if (comString.equals("getnonce") || comString.equa... |
769848f6-ee1a-4a9a-bb83-e2f1bc3d575c | 7 | @Override
public void dispose(){
super.dispose();
if( isModify ) {
// save the user dictionary
UserDictionaryProvider provider = SpellChecker.getUserDictionaryProvider();
if( provider != null ) {
ListModel model = list.getModel();
S... |
3cd697cd-1bee-4f92-8919-42292a4ef9e2 | 1 | public static void main(String[] args) {
Strawberry strawberry1 = new Strawberry("red");
strawberry1.setColor("brown");
// strawberry1.color = "brown";
Strawberry strawberry2 = new Strawberry("blue");
if (strawberry1.getColor().equals(strawberry2.getColor())) {
System.out.println("Strawberry 1 equals strab... |
e3f64fd0-9f2d-43bf-b0f7-3c46743d8856 | 1 | public void testConstructor_ObjectLocalTime() throws Throwable {
LocalTime time = new LocalTime(10, 20, 30, 40);
try {
new LocalDateTime(time);
fail();
} catch (IllegalArgumentException ex) {}
} |
6d8ba696-5fd9-4c79-8c3c-f6c37dc93ab3 | 5 | private E[] checkSequence(final int[] commands) {
int maxSize = 0;
for (int ops : commands) {
maxSize = ops > 0 ? maxSize + ops : maxSize;
}
@SuppressWarnings("unchecked")
E[] vals = (E[]) new Object[maxSize];
assertTrue(queue.isEmpty());
int posW = 0;
int posR = 0;
int tot... |
738a92cd-ac97-4a13-8e53-8d627cf0ba9b | 5 | public boolean containsKey(E e) {
for (int i = 0; i < elements.length; i++) {
Object element = elements[i];
if (e == null && element == null) return true;
if (e != null && e.equals(element)) return true;
}
return false;
} |
b3b901c5-d1da-47f0-b1ba-12a705763780 | 9 | private String checkForChars(String item, String breakDownItem) {
int size = item.length();
int index = item.indexOf(breakDownItem);
if (index < size - 3) {
if (item.charAt(index + 2) == '\'') {
if (Pattern.matches("^\\P{C}*$", item.substring(index + 1, index + 2))) ... |
f3786f8d-754b-4da0-9b91-9edb567661e2 | 0 | public Image getDisplayImage () {
return displayImage;
} |
bf902325-99d7-48a5-a697-b88564194b39 | 4 | public final boolean canRenderSide(Level level, int x, int y, int z, int side) {
if(this != Block.SLAB) {
super.canRenderSide(level, x, y, z, side);
}
return side == 1?true:(!super.canRenderSide(level, x, y, z, side)?false:(side == 0?true: level.getTile(x, y, z) != this.id));
} |
b49e4bdb-177f-4870-b1d3-0e7a8b1e7978 | 1 | public void setSortByLastName(boolean sort) {
if (!sortByLastName) {
Collections.sort(listPhoneBook, new SortedByLastName());
sortByLastName = true;
} else {
Collections.sort(listPhoneBook,
Collections.reverseOrder(new SortedByLastName()));
sortByLastName = false;
}
} |
69f25c51-352b-4766-86da-08902662e16d | 7 | public static List<PortalServerInfo> getServerList(String serverListUrl)
{
ArrayList<PortalServerInfo> toRet = new ArrayList<PortalServerInfo>();
List<String> webpageContents = NetworkUtilities.readWebPage(serverListUrl);
for(String currLine:webpageContents)
{
if(currLine != null)
{
String[] parts = ... |
72858aa8-cd06-433f-bba6-57614ac2a034 | 7 | private void sendObjectDataQuery(final ForeignDynamicObject object) {
final SystemObjectType type = object.getType();
final ArrayList<AttributeGroupUsage> queryUsages = new ArrayList<AttributeGroupUsage>();
if(!type.isConfigurating()) {
final List<AttributeGroup> atgs = type.getAttributeGroups();
for(Attrib... |
e8622843-4fd4-42d9-8ec2-35b692814088 | 0 | public void setTarget(String value) {
this.target = value;
} |
23b08cd6-540c-4ce6-84c5-3ebdb8183f33 | 2 | public String getIfMainWorld(String worldName){
String answer = null;
for (String worldN : this.mainWorlds){
if (worldName.startsWith(worldN + "_")){
answer = worldN;
}
}
return answer;
} |
fa8ac62a-ca3e-41ec-b05b-0c9f1f6a4991 | 5 | */
public double[][] computeDiffMatrix( )
{
// ignore 0th element to simplify indexing
int s = versions.size()+1;
// keep track of the length of each version
int[] lengths = new int[s];
// the length of j last time j and k were joined
int[][] lastJoinJ = new int[s][s];
// the length of k last time j and... |
1fd20499-858a-4415-89dd-7ef8847381c3 | 5 | @Override
public void run()
{
//Thread die Moeglichkeit geben sich zu beenden
while(!finish)
{
PC.setTimeStep();
if(pause)
{
try{Thread.sleep(500);}
catch (InterruptedException e) {e.printStackTrace();}
PC.setTimeStep();
continue;
}
if(!compute(PC.getFrameTime()))
{
delet... |
1246c5f8-c5ae-41e9-bed1-412acae4aaa6 | 9 | @Override
public void lireMateriel() {
boolean oldBtnStart = btnStart;
btnStart=ihm.getClavier().touchePressée(1);
if ((btnStart != oldBtnStart )&& btnStart) {
controleur.start();
}
boolean oldBtnStop = btnStop;
btnStop=ihm.getClavier().touchePressée(2);
if ((btnStop != oldBtnStop )&& btnStop) {
... |
61b712bf-758b-4f2e-8139-113335c390fd | 4 | private void loadLogFromFile()
{
BufferedReader reader = null;
String txt = "";
logField.setText(""); //make it empty
try
{
String path = new Control_GetPath().getStreamRipStarPath() + "/output.log";
reader = new BufferedReader(new FileReader(path));
while((txt = reader.readLine()) != null)
{
... |
da98b021-34a8-4371-8daf-0f9272f04b9c | 9 | static int traverseForward(StorageImpl db, int pageId, int type, int height,
Object[] result, int pos)
{
Page pg = db.getPage(pageId);
int oid;
try {
int i, n = getnItems(pg);
if (--height != 0) {
if (type == ClassDescr... |
04404995-7730-4d3d-8f4f-e444a7662425 | 5 | private Node growNode(int width, int height) {
Node grown = null;
int minWidth = powerOfTwo(this.width + width);
int minHeight = powerOfTwo(this.height + height);
boolean growRight = this.width <= this.height;
boolean growDown = !growRight;
if (width > this.width && height > this.height) {
gro... |
72487cf9-4108-4930-a9d4-cd9c2fd40877 | 9 | private void writeValue(Object value) throws JSONException {
if (value instanceof Number) {
String string = JSONObject.numberToString((Number) value);
int integer = this.values.find(string);
if (integer != none) {
write(2, 2);
writeAndTick(inte... |
b5c9dc22-00f1-4a4d-8abc-d7e4bff8e3c2 | 6 | public Search <T> doSearch() {
final boolean canSearch = canEnter(init) ;
if (verbose) I.say(" ...searching "+canSearch) ;
if (! canSearch) {
if (verbose) I.say("Cannot enter "+init) ;
return this ;
}
tryEntry(init, null, 0) ;
while (agenda.size() > 0) if (! stepSearch()) break ;
... |
8bc9802c-5931-4262-b6b7-bc0f1ec0acb4 | 6 | @Override
public void run(){
try{
System.out.println("check 0");
sock = new Socket( address, port );
in = sock.getInputStream();
out = sock.getOutputStream();
scan = new Scanner(in); /... |
7a2d4649-ffd5-4357-b77e-140696ca6c1d | 9 | public void mouseClicked(MouseEvent me){
TreePath path = tree.getPathForLocation(me.getX(), me.getY());
if(path==null)
return;
if(me.getX()>tree.getPathBounds(path).x+hotspot)
return;
boolean selected = selectionModel.isPathSelected(path, selectionModel.isDigged(... |
a5f225ca-0fcc-413d-906a-ac9b7ee61f13 | 2 | public void updateCity(City c){
if(first_city.getID() == c.getID()){
first_city = c;
}else if(second_city.getID() == c.getID()){
second_city = c;
}
} |
926c8e3d-eeda-41dc-a451-18cd57211682 | 7 | private void outputCompletePage(HttpServletResponse response, LoginForm loginForm, RegisterForm registerForm, List<String> errors) throws IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
generateHead(out);
out.println("<body>"... |
0fe5c47c-92f7-49c5-8fd5-8f1c84728ea7 | 5 | public static boolean isOnline() throws Exception {
try {
if(!manualOverride){
if(isStreaming){
if(new JSONObject(JSONParser.readUrl("https://api.twitch.tv/kraken/streams/runew0lf")).getString("stream").contains("null")){
isStreaming=false;... |
269ce17c-4866-430d-a808-ed7d7f38988b | 3 | private void collectAreas(boolean aProbability)
{
mAreas.clear();
TileSet tiles = new TileSet(mField);
for (TileSet areas : mNumbers.values())
tiles.addAll(areas);
for (int tile : tiles)
mAreas.add(createArea(tile, aProbability));
for (Area area : mAreas)
area.compare(mAreas);
} |
833a39e7-9469-414e-8b46-d7ee2399118c | 1 | public void testToStandardWeeks() {
Period test = new Period(0, 0, 3, 4, 5, 6, 7, 8);
assertEquals(3, test.toStandardWeeks().getWeeks());
test = new Period(0, 0, 3, 7, 0, 0, 0, 0);
assertEquals(4, test.toStandardWeeks().getWeeks());
test = new Period(0, 0, 0, 6,... |
55de4812-b22c-4236-b34b-6b4d9181e96d | 8 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n=in.nextInt();
String[] a = new String[n];
int maxL = 0;
for(int i=0;i<n;i++){
a[i]=in.next();
maxL = Math.max(maxL, a[i].length());
}
StringBuilder result=new StringBuilder();
for(int i=0;i<maxL;i++){
char ini... |
99306f77-3223-43ff-9b5f-45e9f1077146 | 2 | private void setNameValues() {
Name.getInstance().setTitle(
(titleCombo.getSelectionModel().getSelectedItem() == null ? ""
: titleCombo.getSelectionModel().getSelectedItem()));
Name.getInstance().setFirstName(firstNameText.getText());
Name.getInstance().setMiddleName(middleNameText.getText());
Name.g... |
f501d791-2255-4c97-abd8-d8e1242bcc25 | 2 | public void free()
{
for (int i = 0; i < buffers.length; i++) {
if (buffers[i] != null) {
factory.free( buffers[i] );
}
}
} |
eea30650-2fe9-433f-8ad7-3cf8786ddc9a | 7 | public void setMaxTextureSize(long maxTextureSize) {
this.maxTextureSize = maxTextureSize;
/**
* compute max. allowed texture width and depth
* equation:
* width * depth * height * sampleSize = maxTexSize
* and: width/depth = delta.X/delta.Y
* thus: ... |
1cc4a918-8332-4673-a362-8e7264f4c359 | 8 | private static void internalGetArgPositionsForTerm(Object term, Object subTree,
final ArgPosition curPosPath, final List<ArgPosition> result) {
if (term instanceof CycNart) {
term = ((CycNart) term).toCycList();
}
if (term == subTree) {
final ArgPosition newArgPos = new ArgPosition(cur... |
b741e839-5d6a-4b04-bcd8-6a19da9cbc91 | 4 | public void actionPerformed(ActionEvent e)
{
int w = getWidth();
int h = getHeight();
if (pos_x < 0) {
delta[0] = Math.random() % 4 + 5;
} else if (pos_x > w - radius) {
delta[0] = -(Math.random() % 4 + 5);
}
if (pos_y < 0) {
delt... |
96ab4d14-fff6-429e-b25d-36e18043e38e | 7 | void flushBuffer(final IMarkupHandler handler, final boolean autoOpen) throws ParseException {
if (this.standalone) {
handler.handleStandaloneElementStart(
this.elementName, 0, this.elementNameLen, this.minimized, this.elementNameLine, this.elementNameCol);
} else if (au... |
e116a713-0aa9-4b01-86ca-6947d1d632d2 | 0 | @Override
public void mouseReleased(MouseEvent paramMouseEvent) {/**/} |
60796e60-54b3-40fd-8dd1-d781764d77f5 | 1 | @Override
public String toString(){
String toReturn = "INTERNAL:";
for(int i = 0; i<=this.size;i++){
toReturn += this.keys[i];
toReturn+= "->";
toReturn += this.children[i];
toReturn+= ",";
}
return toReturn;
} |
b9576b44-9d01-49fb-b24f-10f84701674e | 9 | private void startup() throws IOException {
installCurrent();
executor.submit(new Runnable() {
@Override
public void run() {
while (!cancel) {
for (WatchEvent<?> evt : key.pollEvents()) {
@SuppressWarnings("unchecked")
WatchEvent<Path> event = (WatchEvent<Path>) evt;
Kind<Path>... |
db369ad8-e846-4a40-90fb-213b6c909f61 | 8 | public void reducePeers() {
while (true) {
boolean done = true;
for (Square square : cells.keySet()) {
Set<Integer> values = cells.get(square);
int size = values.size();
if (size == 0) {
throw new IllegalStateException("... |
51e2e9f0-6c3a-4268-b78f-9fa86907ddd7 | 7 | public void init() {
PlanAreaCreationListener areaCreationListener = new PlanAreaCreationListener();
areaCreationListener.addListener(this);
BuildingPlanner.pm.registerEvent(Type.SIGN_CHANGE, areaCreationListener, Priority.Normal,
BuildingPlanner.plugin);
PlanAreaDestroyListener areaDestroyListener = new PlanAre... |
5489d66a-6820-4833-b1bb-719d951b0ef3 | 3 | private void save() {
if (!getData().has("flags"))
getData().put("flags", new JSONObject());
JSONObject flags = getData().getJSONObject("flags");
if (flags == null) {
flags = new JSONObject();
getData().put("flags", flags);
}
for (Map.Entry<Per... |
03b0699b-3ac6-4438-85da-8cc651e906c4 | 3 | @Override
public void deserialize(Buffer buf) {
maxCase = buf.readByte();
if (maxCase < 0)
throw new RuntimeException("Forbidden value on maxCase = " + maxCase + ", it doesn't respect the following condition : maxCase < 0");
skillId = buf.readInt();
if (skillId < 0)
... |
5551ea79-c33f-43ce-868e-85fb1d2fda75 | 1 | @Override
public boolean init(List<String> argumentList, DebuggerVirtualMachine dvm) {
if (argumentList.size() > 0) {
UserInterface.println("This command takes no arguments.");
HelpCommand.displayHelp(this);
return false;
}
return true;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.