method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
88620835-f331-4d75-a9c0-75e10d99ea23 | 0 | public String getFiledType() {
return filedType;
} |
d6629280-e4ae-4e4a-a10c-2fadf8499b82 | 4 | public void setTekst(String tekst){
//html-trucje om newlines te gebruiken in een JLabel
int splitIndex = tekst.length();
ArrayList<Integer> spaties = new ArrayList<Integer>();
for(int i = tekst.indexOf(' '); i >= 0; i = tekst.indexOf(' ', i + 1)) {
spaties.add(i);
}... |
82b16db6-c0f3-4bbf-b48c-dc14d61abafd | 6 | public String getWinner(){
String winner = "";
if (dealerWin)
winner = "Dealer wins";
if (playerWin)
winner = "Player wins";
//can add in additional conditions for broadcasting busts.
if (((!playerWin)&&(!dealerWin))&&((playerBust)&&(dealerBust)))
winner="Both player and dealer busted!";
return winner;
} |
27b38135-27eb-4f41-a7e9-5d84c6c72edf | 6 | public void solveSudoku(char[][] board) {
LinkedList<Box> s = new LinkedList<Box>();
s.add(nextEmptyBox(board, 0, 0));
while (!s.isEmpty()) {
Box current = s.peek();
if(current == done)
return;
int currentValue = board[current.row][current.colu... |
7510c32b-a9aa-485d-b3e4-041e318791ca | 5 | public boolean onLeaveCommand(CommandSender sender, Command cmd, String label, String[] args){
if (!(sender instanceof Player)) {
sender.sendMessage("Only players can execute this command!");
return true;
}
TeamPlayer tp = getTeamPlayer((Player) sender);
if (tp == null) {
//didn't have a teamPlayer...?... |
b22f7b9c-d836-49ca-afa4-2f26ad3c232f | 6 | public void Solve() {
HashMap<Integer, Integer> nextNumberMemo = new HashMap<Integer, Integer>();
int longestChaingSize = 0;
int smallestMember = 0;
for (int n = 1; n < _maxTerm; n++) {
List<Integer> chain = GetChain(n, n, new HashSet<Integer>(), nextNumberMemo);
... |
9f61a418-7619-4487-a770-d733eb8e7b45 | 2 | public Symbol(String symbol) throws ModelException
{
if (symbol == null || symbol.matches(".*\\d.*"))
{
throw new ModelException("Not a valid symbol:" + symbol);
}
this.symbol = symbol.trim().toUpperCase();
} |
b78006af-6a57-483f-acb7-187d53e4237a | 7 | public static void main(String[] args){
// declare data input and output streams
DataInputStream dis = null;
DataOutputStream output = null;
int count = 0;
try {
// creating folder if necessary for package clarity
File folder = new File("./archives/Ch19");
folder.mkdir();
// creat... |
ff77534a-8a2d-42a2-a1e9-bc6568a7a8c4 | 4 | @Override
protected boolean next() {
switch(state()) {
case one_byte_size_ready:
return one_byte_size_ready ();
case eight_byte_size_ready:
return eight_byte_size_ready ();
case flags_ready:
return flags_ready ();
case message_ready:
... |
7d35823f-c5b3-4452-af0e-12bb4bd7b0ac | 6 | private static List<String> _processAnnotationParameters(
String s, List<String> tokens)
throws IOException {
StreamTokenizer st = new StreamTokenizer(new StringReader(s));
_setupParseTable(st);
while (st.nextToken() != StreamTokenizer.TT_EOF) {
if (st.ttype == StreamTokenizer.TT_WORD) {
if (st.sva... |
c11f86e2-b80a-43ce-986d-e6353aeb9634 | 4 | protected final void onButtonClick(Button var1) {
if(var1.active) {
if(var1.id < 100) {
this.settings.toggleSetting(var1.id, 1);
var1.text = this.settings.getSetting(var1.id);
}
if(var1.id == 100) {
this.minecraft.setCurrentScreen(new ControlsScreen(... |
c16fe0cf-5b11-4cc6-bd40-75d6f88e7717 | 7 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == sectionButton1) { //add a subsection
if (sectionContentFlag == sectionContentState.NOSUB && sectionContentPanel.getComponentCount() != 0) {
//the condition when there are still some questions in the secti... |
bcc121cb-acc4-45aa-878e-d68d3f0d5a28 | 8 | private boolean readUntilMatch(byte[] match, boolean withinBlock)
throws IOException {
int i = 0;
while (true) {
int b = fsin.read();
// increment position (bytes consumed)
pos++;
// end of file:
if (b == -1)
return false;... |
3b027b42-af1d-4e5c-9d7d-e1a8f1371b10 | 9 | @SuppressWarnings("unchecked")
public void open() throws Exception {
System.out.println("Starting....");
portList = CommPortIdentifier.getPortIdentifiers();
System.out.println("found portList = " + portList.toString());
Win32Driver w32Driver = new Win32Driver();
w32Driver.initialize();
try {
while (por... |
70d0af64-e8d0-4aa0-b75d-58563c31ca1d | 7 | public Symbol parse() throws java.lang.Exception
{
/* the current action code */
int act;
/* the Symbol/stack element returned by a reduce */
Symbol lhs_sym = null;
/* information about production being reduced with */
short handle_size, lhs_sym_num;
/* set up direct ref... |
44594410-b604-481a-b6d3-af8dcae09dc3 | 7 | static final int method353(int i, int i_0_, int i_1_) {
anInt485++;
if (i_1_ == -2)
return 12345678;
if (i_0_ > -25)
return 58;
if (i_1_ == -1) {
if ((i ^ 0xffffffff) <= -3) {
if (i > 126)
i = 126;
} else
i = 2;
return i;
}
i = (0x7f & i_1_) * i >> 1768082311;
if ((i ^ 0xffffff... |
d46669de-159d-47d7-bef5-2a3250c5ecda | 2 | public static NoteEditorController getInstance(){
if (instance == null || noteEditorFrame == null){
instance = new NoteEditorController();
}
return instance;
} |
0784018a-709a-4aca-8183-2c5a0f84a48e | 6 | @Override
protected int[] mapColumnsToProperties(final ResultSetMetaData rsmd,
final PropertyDescriptor[] props) throws SQLException {
final int cols = rsmd.getColumnCount();
final int[] columnToProperty = new int[cols + 1];
Arrays.fill(columnToProperty, PROPERTY_NOT_FOUND);
... |
ebfc51d6-3b5a-44e7-9546-c8d567507e55 | 7 | @Override
public void render(int glMode) {
final Vect3D pos = movableEntity.getPos();
final Vect3D speed = movableEntity.getSpeed();
GL11.glTranslatef(pos.x, pos.y, pos.z);
if (Model.getModel().getUiContext().isDebugMode()) {
speed.render(glMode);
GL11.glColor3f(1, 0, 0);
desiredVelocity.render(glMod... |
a1c89fa2-7f0a-4164-905e-53e5b9c4e000 | 4 | protected Pizza createPizza(String item) {
Pizza pizza = null;
PizzaIngredientFactory ingredientFactory =
new ChicagoPizzaIngredientFactory();
if (item.equals("cheese")) {
pizza = new CheesePizza(ingredientFactory);
pizza.setName("Chicago Style Cheese Pizza");
} else if (item.equals("veggie")) {
... |
9d104340-58a9-4f23-83bb-6f3755ddb63c | 8 | private static String encrypt(final int[] key, final String text) {
String encryptedText = "";
logger.log(Level.INFO, "Plain text: {0}", text);
logger.log(Level.FINE, "Key: {0}", Arrays.toString(key));
char temp[][] = new char[text.length()][key.length];
int order[] = new int[key... |
d4524ea1-eaaf-4fdc-bf25-44a658ff6674 | 9 | private int validateUpdate()
{
try
{
int sid;
int upc;
BigDecimal price;
int quantity;
if (shipID.getText().trim().length() != 0)
{
sid = Integer.valueOf(shipID.getText().trim()).intValue();
} else {
return VALIDATIONERROR;
}
if (itemUPC.getText().trim().length() != 0)
... |
4359ce35-dbce-4699-be66-ff90b5933cac | 5 | private Node makeNode (int x, int y, boolean passible){
if (x >= 0 && x < sizeX){
if (y >= 0 && y < sizeY){
if (map [y][x] == null)
map[y][x] = new Node (x, y, this, passible);
return map[y][x];
}
}
re... |
c28af9af-6f2b-4d4c-956c-f6672bf789b4 | 1 | public boolean setUserlistImageHeight(int height) {
boolean ret = true;
if (height <= 0) {
this.userlistImg_Height = UISizeInits.USERLIST_IMAGE.getHeight();
ret = false;
} else {
this.userlistImg_Height = height;
}
somethingChanged();
... |
6d9a3eab-fe1b-44f4-a0ca-3f7ed994cef2 | 6 | @SuppressWarnings("static-access")
public boolean onCommand (CommandSender sender, Command cmd, String commandlabel, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
try {
this.spawnCmd.Command(sender, cmd, commandlabel, args);
... |
b1c1f65c-038e-4939-a447-df7ce822ecab | 7 | public void stepSim(long timeStep) {
long endTime = this.curTime + timeStep;
try {
PreparedStatement getInfected = this.fludb.prepareStatement(
"SELECT infectedID FROM "+EpiSimUtil.dendroConTbl+" WHERE victimID = ?");
Statement getTransEvents = this.fludb.createStatement();
ResultSet transEvents = get... |
f27c4fb1-0386-4272-8fe1-0f1f382c2530 | 1 | public synchronized void skip(int n) throws IOException
{
for (int i = 0; i < n; ++i)
read();
} |
da897a1b-944a-41d4-a45b-b70cb34e353d | 1 | public void resume_egress() {
for (ConnectionProcessor pipe : pipes) {
pipe.resume_egress();
}
} |
e240be72-dbb7-4800-9fa5-ab96f0f73c98 | 6 | private static Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... |
8ee0c20e-4fac-4636-8b05-f2c7c369df7d | 7 | public static void main(String[] args) {
RoomGenerator generator = new RoomGenerator();
TileType[][] map = generator.generateMap(System.currentTimeMillis());
StringBuilder trace = new StringBuilder();
for (TileType[] row : map) {
for (TileType tile : row) {
... |
4ebaae29-ef24-4729-9e2d-3c889523f1c9 | 4 | static private boolean verifyDimensions(int width, int height) {
if ((width > MAX_WIDTH) || (height > MAX_HEIGHT) ||
(width < cropWidth * resizeValue) || (height < cropHeight * resizeValue)) {
return false;
}
return true;
} |
58af2a90-2c88-463b-a03e-81dcfe80e1fb | 2 | public void setBlockType(blockType bT){
this.bT = bT;
try {
this.texture = TextureLoader.getTexture("PNG", new FileInputStream(new File(bT.location)));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch b... |
edcc45d5-b442-4b4d-8afd-2d563e3c1f99 | 3 | public void render(Graphics g) {
if (isVisible) {
super.render(g);
setHeight(items.size() * itemVGap / columns + 10);
setWidth(columns * getLongestItemName().length()*13 + columns * itemHGap + 10);
int nextItem = 0;
/*for(int i = 0; i < columns; i++) ... |
63f1c580-cf57-47a9-bd0a-81f618f79a9d | 5 | public void paintTitle(Graphics g)
{
g.setColor(Color.BLACK);
g.fillRect(0,0,getWidth(),getHeight());
g.setColor(Color.WHITE);
for(int i=0; i<300; i++)
{
g.fillOval(randStars[i].x,randStars[i].y,4,4);
randStars[i].x--;
if(randStars[i].x<0)
randStars[i].x=800;
}
g.setColor(Color.GREEN);
g... |
859091bf-17b3-48a8-b219-b5c8361d86b6 | 4 | private int nextUpgradeIndex() {
if (upgrades == null) return -1 ;
for (int i = 0 ; i < upgrades.length ; i++) {
if (upgrades[i] != null && upgradeStates[i] != STATE_INTACT) return i ;
}
return -1 ;
} |
476f0230-b1e3-4295-8709-5fe61b902da7 | 0 | public void run(){
frame.setVisible(true);
} |
31e02ec9-68c6-4957-815c-1b6afca74d0b | 1 | @Override
public void accepterDefi(long id) {
try {
Defi d = getDefi(id);
d.setEtat();
em.merge(d);
} catch(Exception e) {}
} |
faf3d13d-4ce1-46bb-8330-ebb1ed219908 | 7 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
int resposta;
AcessoSistema ac = new AcessoSistema();
String nomeUsuario = request.getParameter("nomePessoaExterna");
String senha = request... |
59899fcb-fd0a-44ea-b62b-17a4eca8355c | 6 | private void generateLanes(Street street, LaneTemplates laneTemplates, Tile tile)
{
Lane lane = null;
for (LaneTemplate laneTemplate : laneTemplates.getLaneTemplate())
{
lane = new Lane(fGlobals,street);
String from = laneTemplate.getFrom();
String to = laneTemplate.getTo();
Side start = tile.getSid... |
45f027fc-a0c0-494c-94c0-cd3d10244e2e | 9 | public void acceptTrainingSet(final TrainingSetEvent e) {
if (e.isStructureOnly()) {
// no need to build a classifier, instead just generate a dummy
// BatchClassifierEvent in order to pass on instance structure to
// any listeners - eg. PredictionAppender can use it to determine
// the... |
e6c26f79-cd32-43f3-b4e7-028bc8b73ba2 | 2 | public Connection connection() throws Exception{
if (cx == null || cx.isClosed()) {
cx = DriverManager.getConnection(url, user, password);
}
return cx;
} |
9e1e83f7-b333-470e-9703-c4ca0251821d | 5 | @Test
public void testRollbackFailedState() throws ProcessExecutionException, ProcessRollbackException {
IProcessComponent<?> comp = TestUtil.executionSuccessComponent(true);
// use reflection to set internal process state
TestUtil.setState(comp, ProcessState.ROLLBACK_FAILED);
assertTrue(comp.getState() == P... |
374480ed-74d7-4045-93b0-7763590a0eed | 5 | private static void readTable(BufferedReader in, double[][] table, int rows, int cols) throws IOException {
for (int i = 0; i < rows - 1; i++) {
String[] tmp = in.readLine().split(";");
if (tmp[0].startsWith("=")) {
for (int j = 0; j < cols; j++) {
double input = Double.parseDouble(tmp[j + 1]);
t... |
6918ea0d-8479-48ff-a7a1-dba529661ffd | 8 | public void doExperiment() {
int i = 0;
long startTime = System.currentTimeMillis();
for (Node fromNode : graph.getNodes()) {
Dijkstra dijkstra = new Dijkstra(MAXNODES);
dijkstra.computePaths(fromNode);
if(++i % 100 == 0)
{
long endTime = System.currentTimeMillis();
long totalTime = (endTime... |
5a012762-0c75-4973-a5d2-51cc390b271b | 8 | @Override
public void actionPerformed(ActionEvent e) {
String ac = e.getActionCommand(); //get the action command
//---------Connect button event-------------
if(ac.equals("connect")){
try {
portNum = Integer.parseInt((String)portCBox.getSelectedItem()); //store the user's portnumber
... |
3e3a9ca1-337c-43e3-9e6d-13205c38f149 | 8 | public void processEvent(Event event)
{
if (event.getType() == Event.COMPLETION_EVENT)
{
System.out.println(_className + ": Receive a COMPLETION_EVENT, " + event.getHandle());
return;
}
System.out.println(_className + ".processEvent: Received Login Response..... |
eb26fd66-09af-4771-af6f-07dae6d5f48b | 1 | public static void main(String args[])
{
org.omg.CORBA.Object objRef;
try{
// create and initialize the ORB
ORB orb = ORB.init(args, null);
// get the naming service
objRef = orb.resolve_initial_references("NameService");
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRe... |
d979e2a1-fd16-4ed5-9c26-baa4a0dd81d0 | 3 | public static void displayQueryHostnames(ResponseMessage rm) {
ArrayList<DirRecord> allDirRecords;
allDirRecords = rm.getAllDirRecords();
for (int x = 0; x < allDirRecords.size(); x++) {
DirRecord currentRecord = allDirRecords.get(x);
String currentNameInRecord = currentRecord.userNickName;
if (currentR... |
97d9f908-bb05-4766-b5a1-014d5b08d49f | 5 | public Double simula() {
/* Simula fino al numero di job richiesti. */
while (this.getTempiUscita().size() < this.getJobTotali()) {
Event next = this.getCalendar().get_next();
this.setClock(this.getCalendar().get_next_time(next));
// System.out.println(clock + " " + n... |
9fd33e05-1d01-41a4-82dc-b7092eeb4096 | 6 | private boolean isRejectPackage(String className) {
if (packageFilter.size() == 0) return false;
int loc = className.lastIndexOf(".");
String packageName = (loc > 0) ? className.substring(0, loc) : className;
for (String p : packageFilter) {
if (p.endsWith(".*") && packageName.startsWith(p.substring(0, p.len... |
66d3b8a0-c47a-4292-95ff-4f41efc2a312 | 5 | public void visit_dup2_x2(final Instruction inst) {
// If the two four values are all category 1, then duplicate the
// top two values and put them four down. If the top value is of
// category 2 and the next two are of type 1, then dup the top
// value and put it three down. If the top two values are both
//... |
8793ac8c-8ac2-4799-b5f7-2a1ac6e38e2b | 1 | public static void putSortedInput(Comparable[] a)
{
for (int i = 0; i < a.length; i++)
a[i] = i;
} |
2d0be4d3-0d1a-448a-9e8f-25dfbc88fd70 | 8 | public boolean isValid() {
Position destination=getDestination();
Position middle = new Position(start.getY()+(vertical/2), start.getX()+(horizontal/2));
if(!inRange(start) || !inRange(destination))
return false;
if (field.getPiece(start)==null)
return false; //casella di partenza vuota
if (field.getP... |
f0451448-28b8-4aaf-aed1-3caac0fa2afb | 7 | public void onKeyPressed(KeyEvent event) {
switch(event.getKeyCode()) {
case KeyEvent.VK_BACK_SPACE:
if(mFilterString.length() > 0) {
mFilterString = mFilterString.substring(0, mFilterString.length() - 1);
}
mTextArea.setText(mFilterString);
updateFilter(mFilterString);
break;
... |
49c0365f-5390-47ef-bfc4-d4b351670938 | 7 | private void Initialize(char human)
{
assert(human=='w' || human=='b' || human == 'a' || human == 'n');
board = new Board();
switch(human)
{
case 'w':
White.owner = Owner.HUMAN;
Black.owner = Owner.ROBOT;
... |
311f62db-8738-437d-843a-f172c823fc3a | 0 | @Override
public int hashCode() {
return id;
} |
f5afed49-a613-400c-b66a-67e0f966a582 | 4 | public String getValue(String key) throws RuntimeException{
if (!keyPointers.containsKey(key)){
System.out.println("No such key: " + key);
return "3";
//throw new NoSuchElementException();
}
Long position = keyPointers.get(key);
String value = "";
... |
b74f3235-986b-46df-802a-3986d917bccc | 7 | public static boolean copyFile(File from, File to) {
if (!from.exists())
return false;
if (from.isDirectory()) {
if (!to.exists()) {
to.mkdirs();
}
File[] files = from.listFiles();
List<Boolean> bools = new ArrayList<Boolean>()... |
08f7f350-f467-4931-bdf6-2a94d8d4ce25 | 6 | public String Print_header2s()
{
String sData_row;
boolean savespace = false;
Consumer_name = ten_khach_hang.getText().trim();
if(Consumer_name.isEmpty())
{
Consumer_name = ".........................";
}
if(Consumer_name.contains("......")... |
93c3bdbc-c730-43bb-a030-e46ae25454fb | 9 | public List<Usuario> listarTecnico(Tecnico tecnico){
ArrayList<Usuario> listaRetorno = new ArrayList<Usuario>();
if (tecnico.recuperarSiape().isEmpty()
|| tecnico.recuperarSiape() == null){
for (Usuario usuario : this.usuarios) {
if(usuario instanceof Tecnico &&
usuario.recuperarStatu... |
8c37d4a9-9207-4a96-abd9-4a630bcbe312 | 9 | private String getDirectionState(Direction direction){
String tmp;
switch(direction.toString()){
case "EAST":
tmp = "EAST";
break;
case "NORTH": case "NORTHWEST": case "NORTHEAST": case "NONE":
tmp = "NORTH";
break;
case "SOUTH": case "SOUTHWEST": case "SOUTHEAST":
tmp = "SOUTH";
br... |
1af35213-0f6c-42f6-a956-ac46cc800cee | 1 | public ItemID setSize(int s) throws ShellLinkException {
if (type != TYPE_FILE)
throw new ShellLinkException("only files has size");
size = s;
return this;
} |
9dc2e59a-0b56-4d3b-bf63-d922feb7d848 | 6 | public void drawARGBImageOLD(int xPos, int yPos, int alpha) {
int alphaValue = alpha;
xPos += offsetX;
yPos += offsetY;
int i1 = xPos + yPos * RSDrawingArea.width;
int j1 = 0;
int spriteHeight = myHeight;
int spriteWidth = myWidth;
int i2 = RSDrawingArea.width - spriteWidth;
int j2 = 0;
if (yPos < R... |
aee2e0de-4b1d-4804-8445-edc2afdff1ef | 5 | private static <T> boolean isEquiDimensional(T[][] matrix) {
if (matrix.length == 0) {
return true;
}
if (matrix.length == 1) {
if (matrix[0].length != matrix.length) {
return false;
}
}
for (T[] row : matrix) {
if (row.length != matrix.length) {
return false;
... |
118a88ae-5b6b-4b65-8169-3460782cb7a7 | 1 | @Override
public void process() throws ServletException, IOException {
Integer id = Integer.valueOf(super.request.getParameter(Attributes.ID));
if(DataManager.buyProduct(id)) {
forward(Paths.SUCCESS);
} else {
forward(Paths.ERROR);
}
} |
5e175107-edd8-467b-a345-0335e08af854 | 7 | public boolean moveSeeds(int position){
if ( !isValidTurn(position) )
return false;
int iRelativePosition = this.absolutePosition(position);
int iTempPosition = iRelativePosition;
int iNumberOfTakenSeeds = aBowls.get(iRelativePosition).takeAllSeeds();
for (int i = 0;... |
b2647926-3d2e-4c56-a8fb-4e24225f52a4 | 8 | public MessageInStore getMessageInStore4j(byte[] msgId) {
if (init()) {
MessageInStore messageInStore4j = null;
if (null != cache) {
messageInStore4j = cache.get(msgId);
}
if (null != messageInStore4j) {
return messageInStore4j;
... |
3c1b91df-7530-4188-ba23-23249b8d0dea | 0 | public void keyTyped(KeyEvent e) {
} |
0533669a-4ec7-41f0-ba13-2094c3ae7f72 | 3 | private void acao122() throws SemanticError {
if (tipoConstante != Tipo.INTEIRO && tipoConstante != Tipo.CARACTERE)
throw new SemanticError(
"Esperava-se uma constante inteira ou caractere");
tipoLimiteInferior = tipoConstante;
valorLimiteInferior = tipoConstante == Tipo.INTEIRO ? Integer
.parseInt(v... |
f5cd56b3-60b5-410d-8b01-537f5d704fb5 | 1 | public void insertFront(int red, int green, int blue, Object runlength) {
setHead(new SListNode((short) red, (short) green, (short) blue,
runlength, getHead()));
size++;
if (size == 1) {
tail = getHead();
}
} |
a65403d0-4541-478c-a53a-74daf121204a | 9 | @Override
protected void readChild(XMLStreamReader in) throws XMLStreamException {
String childName = in.getLocalName();
if ("gen".equals(childName)) {
humidity[0] = getAttribute(in, "humidityMin", 0);
humidity[1] = getAttribute(in, "humidityMax", 100);
temperatur... |
a21953db-d6b0-44f2-85b1-30ce130a4a3e | 4 | public void guardarComo() {
JFileChooser selector = new JFileChooser();
try {
if (selector.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
fichero = selector.getSelectedFile().toString();
File fl = new File(fichero + ".chp");
if (fl.exi... |
8620de74-63dc-40e5-a7f7-ea2c845439ff | 5 | public void start() throws IllegalStateException {
if (SimulationClock.getInstance().isStarted())
return;
if (communicationHandler == null)
throw new IllegalStateException("CommunicationHandler must be set");
if (world == null)
throw new IllegalStateException("World must be set");
try {
if (!world.i... |
833d0460-f276-4b47-a5c5-bc0e812a2fa9 | 2 | @Override
public void Execute(CommandSender cs, String[] args) {
try {
if(!super.validateInput(args)){
cs.sendMessage(ChatColor.RED + "[FakeLog] You are not allowed to fake " + args[0] + "!");
return;
}
cs.sendMessage(ChatColor.DARK_GREEN + "[FakeLog] Faked the logout of " + args[0] + ".");
Bukki... |
8814f736-c99a-4c4b-8bfd-cb8c9e9939fb | 6 | public Set<Method> getMethodsFromPackage(String basePackage, boolean recursive, MethodMatcher methodMatcher) {
Set<Class<?>> classes = getAllClassesFromPackage(basePackage, recursive);
final Set<Method> finalMethods = new LinkedHashSet<Method>();
for (Class<?> clazz : classes) {
Method[] methods = clazz.getDec... |
2fca5fcc-32fe-4c1e-a39d-2372587a9fc2 | 1 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
System.out.println("appel de la servlet cron DailyBonus");
List<UserModel> users = DataStore.getAllUsers();
for (UserModel user : users) {
user.addUserPoint(Configs.getDailyPoint());
DataSto... |
4b7bb3df-f6bb-424e-81d3-47bb5707e394 | 1 | @Override
public void main() {
cleanOutput();
List<String> requests = new ArrayList<String>();
requests.add("57 in binary");
requests.add("11 in binary");
requests.add("47 in hexadecimal");
requests.add("183 in hexadecimal");
Interpreter interpreter = new Interpreter(new InterpreterContext());
... |
8b7c589f-eef4-488d-a949-acb457b63188 | 1 | public static String itostrb(int binary)
{
/*
* The idea for this one and the next method is that we continually find the remainder if we divided the number
* by the base, this is the digit at the given space, adding that to the appropriate spot in the result. Once we
* add to the string, we divide the numb... |
4ea49ea2-4e08-4332-bf42-9c050448484b | 8 | public void insertString(int offset, String string,
AttributeSet attributeSet) throws BadLocationException {
if (string == null || string.isEmpty())
return;
for (int i = 0; i < string.length(); i++) {
if (acceptedChars.indexOf(String.valueOf(string.charAt(i))) == -1)
return;
}
if (negativeAccepte... |
6aba5cab-0854-43ca-afef-dfd1d7a08071 | 1 | public void visit_faload(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
873a4df1-b6cc-4d99-9d6c-9d9e4bb5c8de | 0 | @Before
public void setUp() {
} |
89b98925-1e52-4f3a-a09e-2b13d2e3abcf | 9 | private char[] readPasswd(InputStream in) throws IOException {
char[] lineBuffer;
char[] buf;
int i;
buf = lineBuffer = new char[128];
int room = buf.length;
int offset = 0;
int c;
loop: while (true) {
switch (c = in.read()) {
case -1:
case '\n':
brea... |
2ad8646b-633b-4b29-a8e7-aad99673d845 | 5 | public static void testCoverFlow() {
if(Debug.coverflow == false)
return;
final boolean testResize = false;
final boolean testMouseHandling = false;
final boolean testKeyboardHandling = false;
final boolean testMouseWheel = false;
if(testResize) {
System.out.print("\n\nTesting Resizing");
System.... |
1ece8b13-226e-45db-a9b8-ba297cffd43d | 8 | public void detectLine(int n) {
for (int i = 0; i < 8; i++) {
for (int j = 0; j < (8 - n + 1); j++) {
boolean lineOk = true;
int first = matrix[i][j];
int k = j;
while (k < j + n && lineOk) {
if (matrix[i][k] != first && matrix[i][k] != 0)
lineOk = false;
k++;
}
if (lineOk) ... |
6b8f33ac-f7e7-4c8b-acc1-89a35bf6c7e0 | 0 | public void deslocar(double x, double y) {
posX += x;
posY += y;
} |
43d53c6b-2bc6-4926-b0c8-9ebdfc3d0114 | 7 | public static void main (String[] args) {
Counter counter = null;
MyLock lock;
long executeTimeMS = 0;
int numThread = 6;
int numTotalInc = 1200000;
if (args.length < 3) {
System.err.println("Provide 3 arguments");
System.err.println("\t(1) <algor... |
a0c45502-b6cc-49e9-a626-ce1da5eefa6d | 2 | public static void main(String[] args){
int[] bonusStart= Statistics.createBonusStart(150, 150, 60, 30, 20, 20);
Statistics stats = new Statistics(bonusStart);
Creature c = new Creature("Test","1",stats);
System.out.println(c.getStats());
for(int i=0; i < 10 ; i++){
c.progress(1);
}
//ClientConnecti... |
c3d02368-09c2-41ef-ae60-f983d0f0900d | 5 | public void run() {
Globals.registerSetting("Tics between downfall", "Cloud", 0, 3000, 300);
while(true){
ticks++;
if(ticks > Globals.getSetting("Tics between downfall", "Cloud")){
downfall = true;
ticks = 0;
}
if(this.size > 3.0f)
downfall = true;
if(this.size < 0.0f){
Random random ... |
51dbc5ac-2eda-4c9f-9505-c903cabe0aa1 | 5 | public Object evaluate(Context c, HashMap map, DataFactory factory) {
Context updated = (Context) c.clone();
updated.setFunctionID(c.getFunctionID());
Function function = (Function) map.get(functionID);
for(int i = 0; i < arguments.size(); i++){
IVPValue value = (IVPValue) ((DataObject)map.get(arguments.get(... |
2dd585bb-6833-45e9-ac94-2d4d22ba80e5 | 6 | public boolean addFile( String fileName ) {
/** Holds the scanned file. */
Scanner scanFile = null;
/** Holds the current line in the file */
Scanner scanLine = null;
/** Holds current word being read in. */
String currentWord;
/** Holds the a collectio... |
357e0040-b7c0-494e-a179-956df644f5ba | 7 | public boolean canDeselect(DefaultMutableTreeNode node) {
boolean permission = true;
if (node instanceof NumberNode) {
NumberNode iteratorChild = (NumberNode) m_TreeModel.getChild(this,
1);
NumberNode maxChild = (NumberNode) m_TreeModel.getChild(this, 2);
//the one case whe... |
c69abeed-4106-429c-be02-a05cb41ba15d | 4 | private void findJsonElementsPath(JsonObject node, String[] propertyName,
List<JsonElement> list) {
for (Entry<String, JsonElement> entry : node.entrySet()) {
if (entry.getKey().equals(propertyName[0])) {
if (propertyName.length == 1) {
list.add(entry.getValue());
} else {
... |
379d4878-c8c6-4bd2-8886-1587c097ec55 | 0 | private static void injectBeans() {
xmlManager = injector.getInstance(XmlManager.class);
fileOperationMask = injector.getInstance(FileOperationMask.class);
validatorStore = injector.getInstance(ValidatorStore.class);
} |
ad55bf61-d4a6-41f0-8bb7-44764039e788 | 6 | private void checkFunctionsAreDefined(SymbolTable table) {
for (Entry<String, SymbolEntry> entry : table.getEntries()) {
SymbolEntry s = entry.getValue();
String funcName = entry.getKey();
SymbolEntry globalFunction = SymbolTable.GLOBAL.get(funcName);
if (s.getType() instanceof FunctionType
&& (globa... |
f7b181ac-beb6-44d1-a805-ad4313ed2eac | 4 | public boolean findBucket(String aBckNam) {
if (aAmzObj != null || aBckNam != null) {
for (Bucket aBckEle : aAmzObj.listBuckets()) {
if (aBckNam.equals(aBckEle.getName())) {
return true;
}
}
}
return false;
} |
40d97503-7b32-4caa-9de1-eda97d067459 | 9 | protected Point getInitialSize() {
Point result = super.getInitialSize();
// Check the dialog settings for a stored size.
if ((getDialogBoundsStrategy() & DIALOG_PERSISTSIZE)!= 0) {
IDialogSettings settings = getDialogBoundsSettings();
if (settings != null) {
// Check that the dialog font matches the... |
7b13eb39-c07a-4c05-96e6-630c5b8f0f51 | 2 | @Override
protected Class<? extends Number> translateReturnType(Class<?> clazz)
{
// averages are always Double
return Double.class;
} |
6b55ee09-2a8c-4699-9e3c-b88734fa00fb | 2 | public String getLibpath() {
List<File> f = res.filterDirectories();
StringBuilder b = new StringBuilder();
for (int i = 0; i < f.size(); i++) {
b.append(f.get(i));
if (i < f.size() - 1) {
b.append(File.pathSeparatorChar);
}
}
return b.toString();
} |
ad26e698-72a0-41b3-ab19-f8c717e0f6bb | 1 | Node(ExecutorService executor) {
this.executor = executor;
flow =
from(UNINITIALIZED).transit(
on(initialize).to(RUNNING).transit(
on(terminate).finish(DONE)
)
);
flow
.... |
adc99831-95c4-41f9-9edc-a931dcc4b6af | 1 | private void checkSourse(File file) throws IOException {
if (file==null)
throw new IOException("File can't be null");
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.