method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b4a5817d-6c55-4e28-b52e-fc944ddb1581 | 8 | static private int jjMoveStringLiteralDfa2_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(0, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(1, active0);
return 2;
}
switch(curChar)
{
cas... |
4b8bfd13-81e5-4083-bd77-c5772ce69041 | 0 | public EncryptedDataType getEncryptedValue() {
return encryptedValue;
} |
437e0a47-d201-4d03-8756-675c8ded688a | 3 | public static Collection<SineCallable> init(int numThreads, int upperBound) {
if (upperBound < 0) {
throw new IllegalArgumentException("Upper bound (N) cannot be negative");
}
if (numThreads < 1) {
throw new IllegalArgumentException("Cannot configure " + numThrea... |
c7bea096-2867-458c-9a8e-dce2327c677d | 5 | public void move(int xa, int ya) {
if(xa > 0) dir = 1;
if(xa < 0) dir = 3;
if(ya > 0) dir = 2;
if(ya < 0) dir = 0;
if(!collision()){
x += xa;
y += ya;
}
} |
b254454e-7314-4247-ab10-ebfdc05222c3 | 7 | public static void process(String file,String provider) throws Exception {
Workbook book = Workbook.getWorkbook(new File(file));
// 获得第一个工作表对象
Sheet sheet = book.getSheet(0);
Map<String, Integer> map = new HashMap<String, Integer>();
genData(sheet, map);
// 得到第一列第一行的单元格
int rows = sheet.getRows();
int c... |
6ffd2849-6363-474a-a5bf-262983313e1b | 9 | public void run(JGraphFacade graph) {
if (graph.getRootCount() == 0)
graph.findTreeRoots();
nodes.clear();
for (int i = 0; i < graph.getRootCount(); i++) {
graph.dfs(graph.getRootAt(i), new JGraphFacade.CellVisitor() {
public void visit(Object parent, Object cell,
Object previousSibling, int laye... |
d4be8177-8fd7-40e7-acb7-dd34570e8059 | 9 | @Override
public void keyPressed(KeyEvent e) {
//had to use if's because user can change controls at runtime
if (e.getKeyCode() == controls[0]){
player.rotatePiece();
} else if (e.getKeyCode() == controls[1]){
player.moveLeft();
} else if (e.getKeyCode() == controls[2]){
player.moveRight();
} else i... |
9b8ad6c2-5c5d-403f-bf2d-7b049856b47e | 5 | public void sortByValue() {
ArrayList newHand = new ArrayList();
while (hand.size() > 0) {
int pos = 0; // Position of minimal card.
Card c = (Card)hand.get(0); // Minimal card.
for (int i = 1; i < hand.size(); i++) {
Card c1 = (Card)hand.get(i);
if ( c1.... |
a9e1d2bf-6fe1-48d8-ab0a-1fd10346930c | 8 | public static FileCache foruser() {
try {
String path = System.getProperty("user.home", null);
if (path == null)
return (null);
File home = new File(path);
if (!home.exists() || !home.isDirectory() || !home.canRead() || !home.canWrite())
... |
3f1d2e3f-6353-4447-864a-4d2929708b62 | 0 | public String getUserId() {
return userId;
} |
b69f9623-d132-44ac-8797-7ff365ffcf74 | 6 | @Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._x1_ == oldChild)
{
setX1((TNInt) newChild);
return;
}
if(this._x2_ == oldChild)
{
set... |
a6fa1a74-b75e-44c9-9db6-f12b00ffcbe4 | 3 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.user");
try {
Criteria criteria = new Criteria();
User currUser = (User) request.getSessionAttribute(JSP_CURRENT_USER);
... |
8b3c2db9-3935-497a-a353-2e7cf0b29084 | 6 | @Override
public void render(GameContainer container, StateBasedGame stateBasedGame, Graphics graphics) throws SlickException {
graphics.drawString("Version: " + Strings.VERSION, 0, height - 20);
Image play = null;
Image options = null;
Image quit = null;
//Select image to display
switch(selected) {
... |
d06dc4e0-c297-445b-9b89-6e559316af20 | 5 | @Override
void handleMessage(ACLMessage msg) {
switch (msg.getPerformative()) {
case ACLMessage.QUERY_REF:
System.out.println("Query Ref received");
sender = msg.getSender();
handleExpression(msg.getContent());
break;
case ... |
0cc50da7-74aa-4f9b-b792-8d99e6f227b7 | 9 | private void startListenerThread() {
readThread = new Thread() {
@Override
public void run() {
while (!GameState.getInstance().isGameOver()) {
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
int offset = 0;
byte[] head... |
c7f97b97-0689-4663-9fc4-724ec4ca312f | 1 | private synchronized void shutdown(){
instances--;
System.out.println("handler shutdown");
if (instances<1){
//Main.control.stateServerListening();
}
server.handlerShutdown(this);
onShutdown();
} |
75221d68-e681-480c-b9b9-5640637b8827 | 1 | @Override
public String toString() {
return getName() != null ? getName() : "_";
} |
2a4a5650-8450-478d-b2ec-486263063ff9 | 4 | public SMPLContainer visitMulAssignExp(ASTMulAssignExp mulAssign, SMPLEnvironment state) {
SMPLContainer expListContainer = mulAssign.getExpression().visit(this, state);
if (!"Vector".equals(expListContainer.getType())) {
System.out.println("TypeError: Expected \"Integer\", got \""... |
ccd5df4f-e4ab-4eb6-bfb3-53779fa0c017 | 2 | public boolean mustProceedSecondScan () {
for (IStringAnalyser analyzer : stringAnalysers) {
if (analyzer.isTwoScansAnalyzer()) {
return true;
}
}
return false;
} |
558198d0-2ba4-421f-8ea4-362e55105614 | 6 | private static void print(String[] temp, String file) {
PrintWriter pw = null;
try {
pw = new PrintWriter(
new FileWriter("testout" + file + ".txt", true));
pw.append("Fields: ");
String str = "Fields: ";
for (Field f : Geometry.getInstance().getMap()) {
pw.append(f.getId()... |
4d3d85b6-1116-4bf9-abcc-729e5d6989c0 | 1 | public void setRadius(double radius) {
if (Double.isNaN(radius))
throw new IllegalArgumentException("Invalid radius given.");
this.radius = Math.min(Math.abs(radius), 360.0);
this.radiusInternal = LatLng.doubleToLong(radius);
} |
cb5ebc94-74fc-43ce-acc9-774b28e47e79 | 6 | private void stop() {
if (isMovingRight() == false && isMovingLeft() == false) {
speedX = 0;
}
if (isMovingRight() == false && isMovingLeft() == true) {
moveLeft();
}
if (isMovingRight() == true && isMovingLeft() == false) {
moveRight();
}
} |
83f5d6ac-b407-4736-a2f8-0db49ca9f135 | 6 | @EventHandler
protected void onPlayerCommand(PlayerCommandPreprocessEvent event) {
if (event.isCancelled())
{
return;
}
Player player = event.getPlayer();
ScavDuelsPlayer dPlayer2 = ScavDuels.scavDuelsPlayer.get(player.getName());
if (dPlayer2 != ... |
64d5bac6-1325-4c60-a2df-777895105d2d | 1 | private void setBalance(BigInteger balance) throws IllegalArgumentException {
if (! this.canHaveAsBalance(balance))
throw new IllegalArgumentException();
this.balance = balance;
} |
17d822b6-bcd3-4011-b50d-c28a0371a70e | 8 | @Override
public Message<?> preSend(Message<?> message, MessageChannel channel) {
try {
Object logMessage = ExpressionUtil.parse(expression, message);
if (logMessage instanceof Throwable) {
StringWriter stringWriter = new StringWriter();
((Throwable) logMessage).printStackTrace(new PrintWriter(stringWr... |
6eb9e405-78ef-459d-bf7e-367d6db82fe7 | 4 | public static void main(String[] args) {
int ms[] = {4, 10, 50, 77, 294, 5 , 55, 77, 0};
// первый вариант, самый оптимальный на мой взгляд
for (int b : ms){
if(b == a){
System.out.println("Первый вариант: " + b);
}
}
//второй вариант
... |
8490a72d-cc29-4c82-aed8-f3d2fb687b0e | 3 | private static void checkNonDebugLabel(final Label label) {
Field f = getLabelStatusField();
int status = 0;
try {
status = f == null ? 0 : ((Integer) f.get(label)).intValue();
} catch (IllegalAccessException e) {
throw new Error("Internal error");
}
if ((status & 0x01) != 0) {
throw new IllegalArg... |
f6e8a424-e66f-4b4c-879b-3e0a3c005dd2 | 7 | public MathModel checkCurrentAnswer(MathModel model) {
// did they provide a valid answer?
if (model.getCurrentAnswer() == NO_ANSWER) {
// no they didn't...
return model;
}
// record the current answer in the grid
log.info("Checking the current answer...");
int x = model.getQuestionFirstNumber()... |
951cee80-5e50-464d-9a93-ca66ba20ae7a | 3 | @Override
public void run() {
try {
System.out.println("Thread-"+myName+" started ...");
init();
float nextLevel=0.25f;
for (int i = 1; i <= executionTimes; i++) {
String tmp = execute();
writer.write(tmp);
write... |
7397ad89-a9d0-4bf2-bf3a-75a3451a36dc | 6 | @EventHandler
public void ZombieMiningFatigue(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Zombie.M... |
545667aa-2c09-4c55-8210-b15808020585 | 4 | public static String getSQLCreateTable(final Class<?> cls) {
final String tableName = Reflection.getSimpleClassName(cls);
final StringBuilder sql = new StringBuilder();
sql.append("CREATE TABLE ");
sql.append(tableName);
sql.append(" (_id INTEGER PRIMARY KEY");
final Field[] fields = Reflection.getNonSta... |
fd04958d-43ee-4bc9-8bc5-e6653541872b | 5 | public Model getDialogueModels(int gender) {
int headId = maleDialogue;
int hatId = maleHat;
if (gender == 1) {
headId = femaleDialogue;
hatId = femaleHat;
}
if (headId == -1) {
return null;
}
Model head = Model.getModel(headId);
if (hatId != -1) {
Model hat = Model.getModel(hatId);
Model... |
06c95a4b-da23-47ef-84d7-b285b4d60703 | 5 | private boolean controlarCampos(){
try{
if(reciboExiste){
Float.parseFloat(jTextField7.getText());
if(!jTextField12.getText().equals(""))
return true;
else
return false;
}
else{
... |
1833af0a-66e0-4ddd-9ac4-4f740ff90859 | 0 | public static void main(String[] args) {
int n = Integer.parseInt(args[0]);
int nfac = fac(n);
System.out.println(n + "! = " + nfac);
} |
b31ab2b4-d9ca-4865-912f-2db4c4c67302 | 7 | * @param a The total input array containing the partition to sort.
* @param start Index of the first element of the partition.
* @param end Index of the element succeeding last element of the partition.
*/
private <T extends Comparable<? super T>> void addWorker(final int index,
final T[] a, final int start, f... |
d34d8192-537f-4030-9860-eef6961436cc | 9 | private Boolean makeCreateTable(Class<?> c, Connection connection) throws SQLException {
StringBuilder query = new StringBuilder();
query.append("CREATE TABLE `" + mysqlDatabase + "` . `"
+ ORM.getTableName(c) + "` ( ");
Boolean first = true;
for (Field objectField : c.getFields()) {
// The field must... |
bf3547bf-206b-4e49-82cc-f812f86d5de6 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final TimeValue other = (TimeValue) obj;
if (time == null) {
if (other.ti... |
df1b3320-8070-4f3b-a58e-7ebdf9786cc7 | 2 | public static Properties loadProps(String path) {
Properties props = new Properties();
try {
props.load(new FileReader(path));
return props;
} catch (FileNotFoundException e) {
return null;
} catch (IOException e) {
return null;
}
} |
452c54c7-ce14-44db-a68c-a79d4fc4001f | 2 | public boolean isPresent(Satisfier satisfier) {
for (int i = 0; i < tabbed.getTabCount(); i++) {
Component c = tabbed.getComponentAt(i);
if (satisfier.satisfies(c, (Tag) componentTags.get(c)))
return true;
}
return false;
} |
56b05535-71df-4c67-bc0f-e5866ba9e13c | 2 | void parseMixed() throws java.lang.Exception
{
char c;
// Check for PCDATA alone.
skipWhitespace();
if (tryRead(')')) {
dataBufferAppend(")*");
tryRead('*');
return;
}
// Parse mixed content.
skipWhitespace();
whil... |
8e4ec1f5-954a-49ff-9a6c-41c4586ba5c5 | 4 | @Override
public void execute()
{
if (removed != null)
{
Iterator<Object> it = removed.iterator();
while (it.hasNext())
{
model.cellRemoved(it.next());
}
}
if (added != null)
{
Iterator<Object> it = added.iterator();
while (it.hasNext())
{
model.cellAdded(it.n... |
2f50285f-5a72-4ba8-b00c-e277eded4b09 | 3 | public ArrayList<Pesquisador> listar(long id) throws Exception
{
ArrayList<Pesquisador> listaPesquisador = new ArrayList<Pesquisador>();
if (id > 0)
{
String sql = "SELECT * FROM Pesquisacolaboradores WHERE id1 = ?";
try
{
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStat... |
6d45af20-7b2f-4d3f-a413-c12f3bec22c3 | 6 | public static Face getFace(int place){
if(place==0) return NORTHERN;
else if(place==1) return EASTERN;
else if(place==2) return SOUTHERN;
else if(place==3) return WESTERN;
else if(place==4) return FLOOR;
else if(place==5) return CEILING;
return null;
} |
870fd250-4498-47c2-b79b-3ff0ec55b506 | 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 Lid)) {
return false;
}
Lid other = (Lid) object;
if ((this.id == null && other.id != null) || (this.id != null... |
c383819f-2de8-4407-9cf1-9a22390a0803 | 5 | public void update(Object target, String fieldname)
{
if (target != null && fieldname != null)
{
try
{
Method getter = target.getClass().getMethod(
"is" + fieldname);
if (getter != null)
{
Object current = getter.invoke(target);
if (current instanceof Boolean)
{... |
fda717e6-77ca-4c49-b4a1-e2cfb8ee91fd | 4 | private void render() {
remove(gc);
gc.removeAll();
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
if (lab.getWalkways()[i][j] == null) {
gc.add(new GImage("player.png", i*16, j*16));
} else if (lab.getWalkways()[i][j]) {
gc.add(new GImage("blank.png", i*16, j*16));
... |
b01d5e4a-8882-44fe-b978-742e1de2182e | 8 | public void computeChoice (int ART_MODE) {
double top, bottom;
if (ART_MODE == FUZZYART) {
// System.out.println("Phase code T computationation FUZZYART");
for (int j=0; j<numCode; j++) {
activityF2[j] = 0;
top = 0;
bottom = alpha;
for (int k... |
f9097c74-a815-4aca-85a2-75905ccb005b | 5 | private static long readInteger(long min, long max) { // read long integer, limited to specified range
long x=0;
while (true) {
String s = readIntegerString();
if (s == null){
errorMessage("Integer value not found in input.",
"Integer in the range " + min + "... |
16bf1d0b-f14b-43e1-8b27-af877e5c8b2d | 6 | public static int createStudent() {
System.out.println("=== Creation of a student ===");
Scanner scId = new Scanner(System.in);
System.out.print("Give a name: ");
String name = "";
while (name.equals("")) {
Scanner scName = new Scanner(System.in);
name = scName.nextLine();
}
System.out.print("Give a... |
9b38d035-bb8f-4400-b6ab-197f6ff9fe09 | 3 | private void tempPrintEdges(String startNode, List<String> edges) {
System.out.println("Circle size "+startNode+":"+edges.size());
if (edges.size() > 0) {
System.out.print("Circle from "+startNode);
String tmpN = startNode;
for (String tmpE : edges) {
String targetNode = null;
if (this.graph.get... |
3fec571d-6c0f-4885-b309-4ee9502dcaeb | 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 Feed)) {
return false;
}
Feed other = (Feed) object;
if ((this.id == null && other.id != null) || (this.id != n... |
6b2ed0a5-453d-4426-8585-2eb2fc1f7409 | 1 | private static String addQuotationMark(String text) {
char[] arr = text.toCharArray();
if (arr.length < 2) {
return text;
}
StringBuilder sb = new StringBuilder(3);
sb.append(arr[0]);
sb.append('"');
sb.append(arr[1]);
return sb.toString();
... |
24683403-2a24-453f-9f38-496bd0d918fb | 3 | FXMLLoader loadSynchronously(final URL resource, ResourceBundle bundle, final String conventionalName) throws IllegalStateException {
final FXMLLoader loader = new FXMLLoader(resource, bundle);
PresenterFactory factory = discover();
Callback<Class<?>, Object> controllerFactory = (Class<?> p) -> ... |
09d50fa9-9fb3-490d-9f5e-4634576c995e | 4 | @Override
public boolean valid() {
return !locationAttribute.isInSmallArea(ctx)
&& (locationAttribute.isInLargeArea(ctx) || (script.houseTask.isInHouse() && !ctx.objects.select().id(MOUNTED_GLORY).isEmpty()) || ILodestone.Lodestone.EDGEVILLE.isUnlocked(ctx));
} |
5aa02322-4244-4743-84fe-9131431159ee | 6 | public ChangenickFrame() {
setResizable(false);
setIconImage(ResourceUtil.getIcon(ResourceUtil.RESOURCE_ADDRESSBOOK)
.getImage());
setTitle("Change nickname");
setBounds(100, 100, 300, 150);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
... |
f70848a6-5546-48bc-aede-c66539d0ff4b | 0 | public State getState() {
return myState;
} |
5faed8d5-9684-4d43-9644-80cfa5fd695e | 3 | private String getNorth(char a) {
if ('0' == a) return "2, N";
if ('1' == a) return "3, N";
if ('2' == a) return "0, halt";
return "1, halt";
} |
6f94cf06-e1ab-4148-8ad2-cc3b21c6eea5 | 6 | public int readPcm(byte[] buffer, int offset, int length) throws IOException {
synchronized (streamLock) {
identificationHeader.getChannels();
if (lastAudioPacket == null) {
lastAudioPacket = getNextAudioPacket();
}
if (currentPcm == null || curre... |
7529e423-22da-4e6e-8aa9-0930362502c0 | 9 | private static boolean processArgs(Option option) throws IOException, InterruptedException {
if (option.isDecodeurl() == false && option.getNbThreads() > 0 && option.isCheckOnly() == false
&& OptionFlags.getInstance().isMetadata() == false) {
return multithread(option);
}
for (String s : option.getResult()... |
27788851-5d08-44c5-9070-53c2a9dc0919 | 3 | @Override
public void update(Observable observ, Object obj) {
GameData g = (GameData)observ;
@SuppressWarnings("unchecked")
EnumSet<UpdateTag> update = (EnumSet<UpdateTag>)obj;
if (update.contains(UpdateTag.END_GAME)){
setEnableNewQPanel(false);
btnModify.setEnabled(false);
btnNewQ.setEnabl... |
6e99db34-4e20-4a60-b4dd-893de638c5ad | 0 | public int calculate(int a, int b)
{
return a - b;
} |
7737f94e-7691-4b69-a079-68f86d50bffe | 6 | static public <T> Comparator<T[]> arrayComparator(Comparator<T> cmp) {
return (a, b) -> {
if (a == null) {
return b == null ? 0 : 1;
} else if (b == null) {
return -1;
}
int n = a.length;
if (n != b.length) {
... |
4916bdc4-b66e-44a3-8eab-62bcdb5255ea | 3 | private void method114() {
for (int i = -1; i < localPlayerCount; i++) {
int index;
if (i == -1) {
index = myPlayerIndex;
} else {
index = playerIndices[i];
}
Player player = localPlayers[index];
if (player !... |
f00dc608-bceb-40fa-a950-f9169d770987 | 4 | private void secondPass() {
int lineCounter = 0;
for (String assemblyLine : data.getAssemblyCode()) {
lineCounter++;
String[] commentSplit = assemblyLine.split(";");
try {
assemblyLine = commentSplit[0];
} catch (ArrayIndexOutOfBoundsException e) {
assemblyLine = "";
}
... |
164c538f-779e-4c27-9e1e-9fddd802aa70 | 4 | public SolicitudDTO getSolicitudDTO(Solicitud solicitud) {
SolicitudDTO solicitudDTO = new SolicitudDTO();
solicitudDTO.setId(solicitud.getId());
solicitudDTO.setFecha_solicitud_solicitante(solicitud.getFecha_solicitud_solicitante());
solicitudDTO.setFecha_solicitud_proveedor(solicitud.getFecha_solicitud_pro... |
74a895de-c675-4565-9001-47e0a7506e86 | 8 | protected ChattyGroup getMyBaseChatGroup(MOB forMe, ChattyGroup[] chatGroups)
{
if((myChatGroup!=null)&&(myOldName.equals(forMe.Name())))
return myChatGroup;
myOldName=forMe.Name();
ChattyGroup matchedCG=null;
if(getParms().length()>0)
{
final int x=getParms().indexOf('=');
if(x<0)
matchedCG=mat... |
9cebf82a-4966-4aaf-9e98-cb20b54bbbab | 1 | @Override
public void set(Short t, Integer... a) {
for (final Integer i : a) { filter[i] = t; }
} |
8f22d3d9-91b0-4f5d-a535-3a0118fc839d | 5 | private static boolean hasAsChild(ClassLoader loader1, ClassLoader loader2)
{
if (loader1 == loader2)
{
return true;
}
if (loader2 == null)
{
return false;
}
if (loader1 == null)
{
return true;
}
for... |
9a0467d7-4762-4b9e-9405-7a68d350a536 | 2 | public void addShow(Show show, String dei){
Days day = Days.valueOf(dei);
int d = day.ordinal();
for (Show show1 : days[d].getShows()) {
if (!show1.getName().equals(show.getName())){
days[d].addShow(show);
}
}
} |
80692fed-7917-4179-bd0a-3caa8571c688 | 9 | private void registerjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_registerjButtonActionPerformed
// TODO add your handling code here:
if(firstNamejTextField.getText().length() == 0 ||
lastNamejTextField.getText().length() == 0 ||
agejTextField.getText... |
7cbc4896-0fee-41db-9c07-4398451c7341 | 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... |
c1e4ae18-969a-4b31-9497-bfd2abed0260 | 4 | public int solution(int[] array) {
if (array.length < 2) {
return array.length;
}
Set<Integer> heightsSet = new HashSet<Integer>();
for (int i : array) {
heightsSet.add(i);
}
Integer[] heights = heightsSet.toArray(new Integer[heightsSet.size()]);
Arrays.sort(heights);
int count = 0;
for (int ... |
e03e5c97-5f65-4ce1-9ed2-133fce84f209 | 1 | public void addListener(ChannelListener listener) {
if (! listeners.contains(listener)) {
listeners.addElement(listener);
}
} |
9796047f-a127-4756-875a-5fc75ff41974 | 4 | public void stop() {
/*if (algorithm != null)
algorithm.defaultSettings();*/
if (savedRandomInitiation) {
Vertex.randomInit.setInitial(1);
}
GUI.controls.refresh();
if (state == RunState.stopped)
return;
state = RunState.stopped;
... |
2b2f26eb-987c-4531-9c7b-346cf0ee7145 | 8 | private void addEnemyLine(int x0, int x1, int y)
{
boolean canAdd = true;
for (int x = x0; x < x1; x++)
{
if (level.getBlock( x, y ) == -95)
{
canAdd = false;
break;
}
}
if (!canAddEnemyLine(x0, x1, y))
... |
0cf24896-f12b-4d0a-b75f-3dc6be707ffa | 4 | public void render() {
int indx = 0;
int longest = 0;
for(String line : lines) {
if(line.length() > longest) {
longest = line.length();
}
}
for(String line : lines) {
for(int i = 0; i < longest; i++) {
Renderer.g... |
8a042155-e62f-4a48-b649-e58eb67ea49c | 0 | public String getComponentTitle() {
return "Multiple Run";
} |
cec8fa67-9795-4d5f-b4a4-c3fafb3ee387 | 5 | private Dockable getDockableInDrag(DropTargetDragEvent dtde) {
if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) {
try {
if (dtde.isDataFlavorSupported(DockableTransferable.DATA_FLAVOR)) {
Dockable dockable = (Dockable) dtde.getTransferable().getTransferData(DockableTransferable.DATA_FLAVOR);
Doc... |
026dfe5c-8913-4e5a-abcc-88676fabe894 | 0 | public void setId(String id) {
this.id = id;
setDirty();
} |
52e37e17-5280-40a7-94c1-3bd62bf4314f | 7 | private String createAuction() {
if (user.isOnline()) {
int duration = 0;
String describtion = "";
try {
duration = Integer.parseInt(stringParts[1]);
if (duration <= 0) {
return "Error: The duration has to be > 0!";
}
for (int i = 2; i < stringParts.length; i++) {
desc... |
317b18de-1464-4fb5-b22e-a28d4021e03b | 2 | public void stop() {
if (audiostream != null)
AudioPlayer.player.stop(audiostream);
if (continuousaudiostream != null)
AudioPlayer.player.stop(continuousaudiostream);
} |
1289f580-e06c-496f-9cd3-9fc23ae29408 | 2 | public int indexOf(Case theCase) {
for(int i = 0; i < plateau.length; i++) {
if(plateau[i] == theCase)
return i;
}
return -1;
} |
390ec3b8-7d23-4878-bec9-7b5f38dfb78f | 2 | @Override
public FractalValue mod(FractalValue val) throws FractalException {
if (! val.isNumber()) {
throw new FractalTypeException(FractalTypes.REAL, val.getType());
} else if (val.isInt()) {
return new FractalInt(intValue() % val.intValue());
} else {
r... |
ce308d6b-ea96-4161-977c-0ffe7e3ec91b | 3 | public int compareTo(TanqRanked t) {
int scoreDiff = (t.tanq.getScore() - tanq.getScore());
if (scoreDiff != 0)
return scoreDiff;
int injuriesDiff = - (t.tanq.getInjuries() - tanq.getInjuries());
if (injuriesDiff != 0)
return injuriesDiff;
int collisionsDiff = - (t.tanq.getCollisions() - tanq.getCollisi... |
25e3e0ad-fa33-4327-a89b-86f664de42e7 | 9 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((msg.amITarget(myHost))
&&(msg.targetMinor()==CMMsg.TYP_SNIFF)
&&(CMLib.flags().canSmell(msg.source()))
&&(smells!=null))
{
final EmoteObj emote=smells.get(CMLib.dice().roll(1,smells.size(),... |
cbb4c65c-8e4e-40e6-8a8d-1a3ec75b1cda | 3 | public VariableSet intersect(VariableSet vs) {
VariableSet intersection = new VariableSet();
intersection.grow(Math.min(count, vs.count));
big_loop: for (int i = 0; i < count; i++) {
LocalInfo li = locals[i];
int slot = li.getSlot();
if (vs.containsSlot(slot) && !intersection.containsSlot(slot))
inte... |
f55f1415-04e7-4074-855c-434ec739d97c | 2 | private void signActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_signActionPerformed
// TODO add your handling code here:
String log = login.getText();
String pass = pwd.getText();
if((log.equals("admin"))&&(pass.equals("admin"))){
RoadList roadList = new R... |
76568f83-a0e2-4f5d-a4df-3efdd24cf121 | 7 | public void setCrouch(boolean crouched) {
if (crouched) {
if (!data.contains("crouched")) {
data.add("crouched");
}
} else {
if (data.contains("crouched")) {
data.remove("crouched");
}
}
// Index 0
byte firstIndex = 0;
if (data.contains("burning")) {
firstIndex = (byte) (firstIndex... |
6ad3a2ab-c8cc-4ac4-9e8c-539e21ce583b | 4 | private static void restoreFromFile()
{
BufferedReader saveReader = null;
saveFile = new File(SAVEFILE);
if(!saveFile.exists() || !saveFile.canRead())
{
System.out.println("File " + SAVEFILE + " does not exist or is not readable.");
return;
}
try
{
saveReader = new BufferedReader(new FileR... |
5fef9fb2-ed2e-449c-8a1d-07b2934c2d09 | 6 | private boolean isLuaErr(int err, LuaState ls){
if(err != 0 || this.isDebug())
{
switch (err)
{
case 1 :{
log(pluginName+ "Runtime error. " + ls.toString(-1));
return true;}
case 2 :{
log(pluginName+" File not found o... |
dfa7ad7a-b1b4-43c3-ad4d-e211035bc878 | 3 | private static boolean allNumbers(String word) {
for (int i = 0; i < word.length(); i++) {
if (word.charAt(i) < 48 || word.charAt(i) > 57)
return false;
}
return true;
} |
fca71805-35ce-471e-b83a-dd3b78068889 | 0 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
nuevo.setVisible(true);
nuevo.setTitle("Añadir cliente nuevo");
nuevo.setSize(500, 400);
}//GEN-LAST:event_jButton3ActionPerformed |
741cd975-43c0-45d6-bd63-808d5d6075bd | 6 | public double addRoot(Complex root) {
ListIterator<Complex> i = (ListIterator<Complex>) roots.iterator();
double colorFactor = 2 / rootBoundry;
int closest = 0;
double minDistance = 100;
while (i.hasNext()) {
int index = i.nextIndex();
Complex c = (Complex) i.next();
double dist = distance(root, c... |
81546e48-e058-430d-90f5-cc183f0e69e6 | 8 | private static int decode4to3(byte[] source, int srcOffset,
byte[] destination, int destOffset, int options) {
// Lots of error checking and exception throwing
if (source == null) {
throw new NullPointerException("Source array was null.");
} // end if
if (destination == null) {
throw new NullPointerEx... |
ee6a2b75-baa9-4548-9ed6-8295826d4233 | 5 | @Override
public void keyReleased(KeyEvent k) {
if (k.getKeyCode() == KeyEvent.VK_SHIFT)
map.getChar().setRunning(false);
if (k.getKeyCode() == KeyEvent.VK_A)
map.getChar().setMovingLeft(false);
if (k.getKeyCode() == KeyEvent.VK_W)
map.getChar().setMovingUp(false);
if (k.getKeyCode() == KeyEvent.VK_D)... |
d28de806-03c7-44b2-9847-d3ad16f46585 | 4 | protected Collection<String> getProperties(String name) {
List<String> values = uriInfo.getQueryParameters().get(name);
List<String> properties = new ArrayList<>();
if (values != null) {
for (String value : values) {
String[] parts = value.split(",");
for (String part : parts) {
... |
eeb90b6b-16df-4ef3-8dad-5aebdcfad252 | 7 | public boolean checkWave(int wave, int audioFormat, int channel, int sampleRate, int bits){
boolean flag = false;
if (wave == 1163280727){
flag = true;
}
else {
flag = false;
}
//java.nio.ByteBuffer.wrap(headerAudioFormat).getInt();
if (audioFormat == 1){
flag = true;
}
else {
flag =... |
1b5b98bc-01c3-4244-9c4e-ee2cf7516d47 | 9 | private int minimalThrow() {
int start = 0, destination = 100;
Queue<Integer> queue = new LinkedList<Integer>();
boolean[] visited = new boolean[101];
int[] distance = new int[101];
queue.add(start);
visited[start] = true;
distance[start] = 0;
while (!que... |
0c95d88d-fbee-4e93-9cb2-12b678c39879 | 2 | public boolean equals(Object o) {
if (! (o instanceof Type))
return false;
return o.getClass() == getClass() && eq(clazz, ((Type)o).clazz);
} |
70ade314-11c0-4a11-8ca6-7e47493d10c6 | 5 | private synchronized void takeAction(MessageObj mess, InetAddress address, ObjectOutputStream out) {
switch (mess.getMsgType()) {
//User asked for list of users
case 0:
returnUsers(out);
break;
//User sent a message
case 1:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.