method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
84a5e757-8eda-40f2-ae4b-9542c465385c | 5 | public void save() {
if (ChristmasCrashers.isDebugModeEnabled())
System.out.println("Saving world " + ID + ".");
if (!containsLoadedLevels()) {
if (ChristmasCrashers.isDebugModeEnabled())
System.out.println("Aborting save operation for world " + ID + " - world does not contain any loaded levels.");
re... |
a73d963b-201a-435f-be7d-2123631865e2 | 8 | public static boolean isPositionBetweenPositionsOnLine(int positionX, int positionA, int positionB) {
// if positionX is not between other positions, it can't be between
// them. Duh...
boolean greaterThanBoth = (positionX > positionA) && (positionX > positionB);
boolean lowertThanBoth ... |
2dae569d-179d-47f6-9a12-2cc89d422921 | 5 | final boolean method2504(int i, int i_32_, AbstractToolkit var_ha, int i_33_) {
if (i_33_ >= -37)
method2502(null, -82);
anInt6407++;
int i_34_
= ((Class318_Sub4) this).aClass318_Sub1_6410.method2393(-117);
if (((Class318_Sub4) this).aClass318_Sub3Array6414 != null) {
for (int i_35_ = 0;
((Class31... |
326afb94-3167-462d-8471-ad1f943526c1 | 7 | public static BlockType getBlockType(Block block){
short[][] cellsWithLayers = block.getCells();
int layerCount = 0;
for(short[] layeredCell : cellsWithLayers){
layerCount = Math.max(layerCount, layeredCell.length);
}
if(layerCount > 1){
return BlockType.MULTILEVEL;
} else {
for(short[] layered... |
28167916-6a52-4d04-9d58-3f2f164d74f7 | 1 | @Override
protected int[] orderArray() {
for(int i = 0; i < len(); i++) {
swap(getPosOfMinimumFromPos(i), i);
}
return array;
} |
53d10fcb-a35d-4642-9e79-b2b6bc585445 | 8 | public Object getValueAt(int row, int column) {
//FTPFile file = files[row];
FTPFile file = files.get(row);
switch (column) {
case 0:
/*
* Works, but it creates new files every time listing is called (simpler - is called A LOT),
* so it'... |
4f57d4c4-ecf3-4f2a-9eef-f90f6f2eae72 | 0 | public void setEmptyString(String empty){
emptyString = empty;
} |
b4cafbd2-b28a-4bb7-8f57-bfb615d64f11 | 5 | public static boolean[] zeroCrossingBoolean(short sample[]){
boolean crossingBoolean[] = new boolean[sample.length];
for (int c = 0; c < sample.length - 1; c++){
if (((sample[c] > 0) && (sample[c + 1] < 0)) || ((sample[c] < 0) && (sample[c + 1] > 0))){
crossingBoolean[c] = tr... |
5ab1665d-b92d-4ae8-a774-f333030e22d1 | 5 | private static double yieldIteration( double DSC,
double E,
double n,
double A,
double rate,
int frequency,
... |
b2310ac3-7918-406e-a307-fb5f42fac1f9 | 7 | public Word[] getAlternatives(Word word) {
String str = word.getWord().toLowerCase();
int n = str.length();
Word[] result = new Word[53*(n+1) + 25];
StringBuilder sb;
StringBuilder sb2;
int add = 0;
//Deletion
for(int i = 0; i < n; i++){
sb = new StringBuilder(str);
result[add++] = new Word(sb.d... |
9a3406fc-325d-4578-825d-5ebda29222d1 | 9 | private boolean check(FlowNetwork G, int s, int t) {
// check that flow is feasible
if (!isFeasible(G, s, t)) {
System.err.println("Flow is infeasible");
return false;
}
// check that s is on the source side of min cut and that t is not on source side
if... |
05389c7f-aca7-4030-966e-248bff80202f | 0 | public String getOpenEncoding() {return openEncoding;} |
0cd59652-8995-4a37-83c7-a4742a8b99c0 | 7 | @SuppressWarnings("unchecked")
@Test
public void testGaps() {
SimpleValidator simpleValidator = new SimpleValidator();
DateRangeBean bean;
Set<?> validations;
for (int minutes = -45; minutes <= (120 * 60); minutes += 5) {
bean = new DateRangeBean();
bean.setDate11(util.add(new Date(), Calendar.MINUTE, m... |
26ceb4e1-6937-428f-9f0d-1697e288ad80 | 1 | public synchronized void tick() {
while (!toggles.isEmpty()) {
Toggle toggle = toggles.removeFirst();
toggle(toggle.keyEvent, toggle.down);
}
} |
9fbc01db-d02a-46ab-a4b2-95aef5b18a5a | 0 | @Test
public void testValidGroupCanBeCreated() throws Exception {
GroupObject validGroup = new GroupObject("habrahabr", "labrabar", "xerahabr");
createGroup(validGroup);
} |
edb88634-33f4-40c4-b7b0-f5fce196cf88 | 4 | @Override
public void run() {
try {
BufferedReader reader = new BufferedReader(
new InputStreamReader(connection.getInputStream()));
// Request is first line of header.
String request = reader.readLine();
System.out.println(request);
String[] requestParts = request.split(" ");
Stri... |
47db082a-4f94-4db8-98ca-b697153be195 | 2 | @Test
@Ignore
public void test_RegistrantListGet()
{
RegistrantList laRegList = laClient.getRegistrantList(5,
"2012-01-25-12.36.43.023001");
System.out.println(laRegList.getRegistrantList().size());
if (laRegList.getRegistrantList().size() > 0)
{
for (Registrant laReg : laRegList.getRegistrantList())
... |
7c748820-533b-4769-ad4a-7bd50fa965f5 | 5 | public static Map<String,String> getPluginFileMap()
{
Map<String,String> pluginList = new HashMap<String,String>();
try
{
File jarLocation = new File(ControllerEngine.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
String parentDirName = jarLocation.getParent(); // to get the... |
10c1bdcf-9683-4b80-bcc0-d6fa60342d80 | 6 | @Test
public void stepsTest2() {
userInput.add("hello");
userInput.add("daniel");
userInput.add("can you help me with cooking");
userInput.add("tell me the steps");
userInput.add("hamburger");
userInput.add("steps");
runMainActivityWithTestInput(userInput);
assertTrue(nlgResults.get(2).contains("what")... |
c4bfe6cb-af6d-459e-af67-337fc121f107 | 6 | public static void main(String[] args) {
if(args.length == 0) {
System.err.println("Specify a weka configuration file!");
return;
}
File cf = new File(args[0]);
if(!cf.exists() || !cf.isFile()){
System.err.println("Specify a weka configuration file!");
System.err.println(args[0] + " does not exist o... |
6ebad553-6e09-416b-a72b-a26c0c172201 | 5 | public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("Female")) {
view.NBL.learn(view.NBC.fWords, view.inputField.getText());
//view.dispose();
}
if (e.getActionCommand().equals("Male")) {
view.NBL.learn(view.NBC.mWords, view.inputField.getText());
//view.dispose();
}
if (e... |
b8bbd1b1-e194-456c-b4f5-521aec80c3f8 | 4 | public boolean valido(List<String> feedbacks) {
boolean valido = true;
if (nome == null || nome.isEmpty()) {
feedbacks.add("O nome do produto não pode estar em branco.");
valido = false;
}
if (resumo == null) {
feedbacks.add("O resumo do produto não pode estar em branco.");
valido = false;
... |
e6614a9e-853f-4ce5-a3a9-3ab4e2880f71 | 5 | public static synchronized void pushSessionForUpload(ScanSession session, boolean bypassFOD, boolean putInTable) {
if (!initialized)
init();
boolean fileOutOfDate =
!fileLastModified.containsKey(session.getFile()) ||
fileLastModified.get(session.get... |
d4295ab3-5a0d-419d-abdf-5776b2d407e8 | 2 | int[] parseWeights(String line, String lineType) {
// Sanity check
if (line.startsWith(lineType)) line = line.substring(lineType.length());
// line = line.replace('[', ' ').replace(']', ' ');
line = line.replace('[', ' ').replace(']', ' ').trim();
// Split weights
String weightStr[] = line.split("\\s+");
... |
83b42805-3582-4bbd-9752-67d1525c81c9 | 0 | public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
} |
54512878-854d-40ce-a02b-2477ea41a433 | 4 | public void setComando(List<?> list)
{
for(PComando e : this._comando_)
{
e.parent(null);
}
this._comando_.clear();
for(Object obj_e : list)
{
PComando e = (PComando) obj_e;
if(e.parent() != null)
{
e.pa... |
873a7e0a-ff9c-4fba-8de8-bddd3c35417e | 0 | @After
public void tearDown()
throws Exception
{
this.scheduler.shutdown();
} |
6f1d05d7-15af-4e03-82ac-543ef5a425f0 | 8 | @Override
public double convertTo(int type) {
switch (type) {
case UnitConstants.FEET_SECOND:
return getValue() * 54.68066;
case UnitConstants.FEET_MINUTE:
return getValue() * 3280.84;
case UnitConstants.MILES_MINUTE:
return... |
17a18e84-e73f-41ff-a44d-40e4c52c89a0 | 5 | private void shiftLeaf(final int fromIndex, final int destIndex, Array<E> newArray) {
if (Math.min(fromIndex, destIndex) < array.getSize()) {
newArray.setElement(destIndex, array.getElement(fromIndex));
// There is no point to move nulls, so the condition is cheked for
if (!... |
974cb771-589b-4abd-afbd-d524ca893b8c | 9 | public Map getArgumentTypeChoicesArray(int argumentType)
{
Map map = new HashMap();
String[] labels = null;
switch (argumentType)
{
case ARGUMENT_TYPE__TARGET_TYPE:
Integer targetTypes[] = getTargetTypes();
for (int targetTypeIndex = 0; tar... |
f70c17c3-da0e-44ba-b1ce-0c0ff49c6b64 | 2 | @Override
public int[] orderArray() {
for(int i = 0; i < array.length; i++ ) {
for(int j = array.length - 1; j > i; j--) {
swapIfFirstIsLess(j, j - 1);
}
}
return array;
} |
cd329d81-f403-4b19-bbdb-831a0f980f48 | 9 | public static MoodleCourse[] getCoursesById(long[] courseids) throws MoodleRestException, UnsupportedEncodingException{
Vector v=new Vector();
MoodleCourse course=null;
StringBuilder data=new StringBuilder();
String functionCall=MoodleCallRestWebService.isLegacy()?MoodleServices.MOODLE_C... |
f8e1e6e3-75f1-4ae3-b0e8-ad3d13f26787 | 5 | public static void removeSign(Sign sign){
if(sign != null){
for(Entry<Arena, ArrayList<Sign>> entry : signs.entrySet()){
if(entry.getValue().contains(sign)){
ArrayList<Sign> arenaSigns = entry.getValue();
arenaSigns.remove(sign);
signs.put(entry.getKey(), arenaSigns);
File fichier_signs = ... |
e2563073-7dfa-491e-b501-d8f4e4f1c2f7 | 0 | private void addEngineCommands() {
this.addCommand(new CommandSVCheat());
this.addCommand(new CommandHelp());
} |
d78ff41a-d449-4b5e-9aed-38347bbff484 | 3 | public List<List<Object>> sortList(List<List<Object>> listToSort) {
int listSize = listToSort.size();
boolean swapped;
do {
swapped = false;
for (int i = 0; i < listSize - 1; i++) {
int one = (Integer) listToSort.get(i).get(0);
int two = (... |
41a88060-6590-4daa-8e91-1964172d729e | 4 | private void parseGetParameters(String url, List<PostParameter> signatureBaseParams) {
int queryStart = url.indexOf("?");
if (-1 != queryStart) {
String[] queryStrs = url.substring(queryStart + 1).split("&");
try {
for (String query : queryStrs) {
... |
3b9aa6f7-83cd-4784-98ed-09ceddc6062e | 6 | public void drawSprite1(int i, int j)
{
int k = 128;//was parameter
i += anInt1442;
j += anInt1443;
int i1 = i + j * DrawingArea.width;
int j1 = 0;
int k1 = myHeight;
int l1 = myWidth;
int i2 = DrawingArea.width - l1;
int j2 = 0;
if(j < DrawingArea.topY)
{
int k2 = DrawingArea.topY - j;
k1 ... |
14bf31b5-d188-4b71-acdf-0086bcc0775a | 3 | private void processProjectiles() {
if (fire||fireCount!=3) {
fireCount--;
if (fireCount==0) {
bulMan.createBullet(car);
fireCount=3;
}
}
bulMan.moveBullets();
} |
1717515c-ba0b-47f8-ab12-b3b4159473cc | 6 | public void actionPerformed(ActionEvent e)
{
try
{
controller.setSimpNum(Double.parseDouble(simpParam.getText()));
}
catch(NumberFormatException exc)
{
controller.setSimpNum(0);
... |
920840df-3f2b-4327-b757-710e8636dfeb | 0 | public Board getBoard(){
return field;
} |
2a317d76-d1a4-4823-8bf1-757a742470cb | 8 | public void run() {
try {
byte[] buffer = new byte[BUFFER_SIZE];
while (true) {
final int bytesRead = m_in.read(buffer, 0, BUFFER_SIZE);
if (bytesRead == -1) {
break;
}
final byte[] newBytes =
m_filter.handle(m_connectionDetails, buffer, bytesRead);
m_outputWriter.flush();
... |
d059803c-629a-4168-80bb-02a3ca79146e | 4 | public boolean connect(String ip, int port) {
try {
clientSocket = new Socket(ip, port);
outToServer = new ObjectOutputStream(clientSocket.getOutputStream());
inFromServer = new ObjectInputStream(clientSocket.getInputStream());
while (((String)inFromServer.readObject()).startsWith("1")) {
gui.requestN... |
d5359318-7021-472d-88e0-ac13fcba3ac3 | 0 | public void setUserName(String username) {
mUserName = username;
} |
ea5f1391-4220-49a1-a8a4-72583396885c | 4 | public static double rint(double x) {
double y = floor(x);
double d = x - y;
if (d > 0.5) {
if (y == -1.0) {
return -0.0; // Preserve sign of operand
}
return y+1.0;
}
if (d < 0.5) {
return y;
}
/* ... |
088b5abf-7b96-4beb-a054-90c162ef76fc | 2 | @Override
public void run() {
if (mVerify) {
OpenCommand.INSTANCE.adjust();
if (!OpenCommand.INSTANCE.isEnabled()) {
return;
}
}
OpenCommand.open(mFile);
} |
64f03028-11fb-4a27-ac9d-9e50c19714d1 | 2 | public void register(Object owner, T toRegister, Class... classes)
{
for (Class clazz : classes)
{
provided.put(clazz, toRegister);
}
provided.put(toRegister.getClass(), toRegister);
List<T> list = providedByOwner.get(owner);
if (list == null)
{
... |
b40529ca-5560-4698-8ba2-eeb6f4a6b1db | 6 | private void authentification() throws IOException
{
Command cmd = this._in.readCommand();
char op = cmd.getOperator();
CommandArgsIterator args_it = (CommandArgsIterator) cmd.iterator();
if (op == 'C' && args_it.hasNext()) {
// Vérifie atomiquement si le nom d'... |
33a09579-8034-4f72-bb76-c99a92d58a55 | 7 | @SuppressWarnings("resource")
public void setMapFromFile(String fileName) throws FileNotFoundException, MapFileException {
Scanner scanner = new Scanner(new File("files/"+fileName));
// width
if (scanner.hasNextInt()) {
int width = scanner.nextInt();
if (width >= 0) {
this.widthMap = width;
}
... |
11247dbd-fb8b-443a-8132-d7fccc13180f | 9 | public static void main(final String[] args) throws Exception {
int i = 0;
int flags = ClassReader.SKIP_DEBUG;
boolean ok = true;
if (args.length < 1 || args.length > 2) {
ok = false;
}
if (ok && "-debug".equals(args[0])) {
i = 1;
flags = 0;
if (args.length != 2) {
ok = false;
}
}
if... |
d19c955a-c1a6-4322-ab36-912cd005d55c | 5 | public ArrayList<Borrowing> getBorrowingAllBySubject(String subject){
ArrayList<Borrowing> borrowing = new ArrayList<Borrowing>();
Statement stmt;
ResultSet rs;
PreparedStatement ps;
try
{
stmt = con.createStatement();
//ps = con.prepareStatement("SELECT * FROM borrowing inner join hassubject WHERE ... |
f987ca38-5c1b-452e-9687-f0feacbf7f7a | 4 | protected long realCreate(AttrSetter attrSetter, String insertStatement)
throws IOException {
int retryCount = 0;
PreparedStatement stmt = null;
ResultSet generatedKeys = null;
while (true) {
try {
stmt = conn.getPreparedStatement(insertStatement, Statement.RETURN_GENERATED_KEYS);
... |
9916d850-a357-4768-971a-13a31d0a6798 | 1 | private int plateScore(int[] plate)
{
int score = 0;
for(int i = 0; i < length; i++)
score = score + plate[i] * (length - i);
return score;
} |
b3acf8c8-559e-4e43-aef2-bd8ffffd88a3 | 6 | @Override
public void expand(int grabber, Point endMove, int canvasWidth, int canvasHeight)
{
if((endMove.getX() > 0)
&& (endMove.getY() > 0)
&& (endMove.getX() < canvasWidth)
&& (endMove.getY() < canvasHeight))
{
switch (grabber)
{
case 0:
x = endMove.getX();
y = endMove.getY();
break;... |
e4c0d004-4dd6-4a38-a5dd-b3972411ddc6 | 7 | public void setup(Context context) throws IOException {
// 读取随机向量信息
Path[] caches = DistributedCache.getLocalCacheFiles(context
.getConfiguration());
if (caches == null || caches.length <= 0) {
System.err.println("Random vector is missing!");
System.exit(1);
}
BufferedReader br = null;
br = new B... |
6c62fc06-6f92-4039-90d9-865a05569413 | 1 | private void disconnectQuietly() {
synchronized(CONNECTION_LOCK) {
try {
//inform the server of the client's intent to disconnect
logger.finer("Sending disconnect packet");
sendPacket(Packet.createClientDisconnectPacket(clientId));
}
catch(CouldNotSendPacketException e) {
//ignore all excepti... |
180c9ce2-774b-4c85-9e41-d937e2cc5cef | 4 | static void dradb3(int ido, int l1, float[] cc, float[] ch, float[] wa1,
int index1, float[] wa2, int index2){
int i, k, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10;
float ci2, ci3, di2, di3, cr2, cr3, dr2, dr3, ti2, tr2;
t0=l1*ido;
t1=0;
t2=t0<<1;
t3=ido<<1;
t4=ido+(ido<<1);
t5=0... |
87396424-1d7c-4503-aa25-92f6ac2ed14a | 6 | @Override
public boolean equals(Object object){
if(object instanceof Jornalista){
Jornalista j = (Jornalista)object;
if(j.getId() == this.getId() && j.getNome().equals(this.getNome()) && j.getLogin().equals(this.getLogin()) && j.getSenha().equals(this.getSenha()) && j.getEmail().equa... |
547c97b0-dc13-4303-b214-052eb0a22cd0 | 6 | @Override
protected void onButtonReleased(GuiButton button)
{
super.onButtonReleased(button);
if (button.id == 0)
{
this.parent.setIngameGui(new GuiBuyHouses(this.parent, this.player));
}
else if (button.id == 1)
{
}
else if (button.id == 2)
{
this.state = TurnState.ROLL;
}
else if (butt... |
905d00a6-d064-46da-8645-a6c779346822 | 8 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><body>");
// Check for session obj, if null the... |
424cb8f9-a977-4e67-8c6a-f13113180a51 | 1 | public static int update(String sql,Statement stmt) {
int ret = 0;
try {
//System.out.println("SQL Statement: "+sql);
ret = stmt.executeUpdate(sql);
} catch (SQLException e) {
e.printStackTrace();
}
return ret;
} |
d8d68cd0-4378-4fb9-8faf-9f5e518796a5 | 9 | @SuppressWarnings("rawtypes")
public final static Farmacia jsonToFarmacia(String json) throws ParseException {
Farmacia farm = new Farmacia();
JSONParser parser = new JSONParser();
ContainerFactory containerFactory = new ContainerFactory() {
public List<String> creatArrayContainer() {
return new LinkedLis... |
4b106019-3823-4218-abf4-2805c1e08c04 | 4 | private void removeFromModel( final Collection<Note> notes, final Collection<Note> notToRemove ) {
final Set<Long> notToRemoveIds = new HashSet<Long>();
for( final Note n : notToRemove ) {
notToRemoveIds.add( n.getId() );
}
final LinkedHashSet<Note> notesToRemove = new LinkedHashSet<Note>();
for( final No... |
db5e5ee0-27d9-47c8-b71d-5f7429a820c8 | 9 | protected double[] getNumericFeatureArrayFromFields(Object o)
{
ResizableDoubleArray arr = new ResizableDoubleArray();
//Set up the fields if they've not been handled previously
if(this.numericFeatureFields == null)
{
this.initNumericFeatureFields(o);
}
for(String field : this.numericFeatureField... |
2fe0188a-8fad-4bb2-86c4-6daa0cef46de | 5 | private boolean nuevoUsuario(HttpServletRequest request, HttpServletResponse response) {
String nombre = request.getParameter("nombre");
String apellidos = request.getParameter("apellidos");
String dni = request.getParameter("dni");
String direccion = request.getParameter("direccion");
... |
c66d2446-8c79-42ea-b366-743ab876c871 | 0 | @Test(expected = IOException.class)
public void testFinalBlockOftestRunFinished() throws Exception {
OutputStream stream = new OutputStream() {
@Override
public void write(int b) throws IOException {
throw new IOException("Oops");
}
};
new ... |
63bf42c1-7ae5-40fc-bd4d-1a28f5da1952 | 7 | void minWidthOrder(Vertex[] V){
ArrayList<Vertex> L = new ArrayList<Vertex>(n);
Stack<Vertex> S = new Stack<Vertex>();
for (Vertex v : V) L.add(v);
while (!L.isEmpty()){
Vertex v = L.get(0);
for (Vertex u : L) if (u.degree < v.degree) v = u;
S.push(v); L.remove(v);
for (Vertex u : L) if (A[u.ind... |
680b0788-0aa9-4354-9785-13dbb37f7d2f | 4 | public void createLevelTwoMines(){
twoMine.add(new Mine(105, 65, false));
twoMine.add(new Mine(115, 50, false));
twoMine.add(new Mine(100, 30, false));
int helpNumber = 280;
for (int i=0; i<3; i++){
twoMine.add(new Mine(helpNumber, 220, true));
he... |
20bd545c-6842-479d-a448-026c161a7c73 | 2 | public void setRef1(String ref) {
if (ref != null && ref.length() > 256)
throw new IllegalArgumentException("Ref cannot be longer than 256 characters!");
this.ref1 = ref;
} |
20f7e199-8741-45af-8dae-f78d8511bd86 | 4 | public static void loadProperties(Path settings) {
prop = new Properties();
if (FileUtil.control(settings)) {
try (FileReader reader = new FileReader(settings.toString())) {
prop.load(reader);
{
backUp = Boolean.parseBoolean(prop.getPrope... |
c647736a-a780-479f-b07a-c9e30f891e77 | 4 | public TrackedPeer update(String event, ByteBuffer peerId,
String hexPeerId, String ip, int port,
long uploaded, long downloaded, long left)
throws UnsupportedEncodingException {
TrackedPeer peer;
TrackedPeer.PeerState state = TrackedPeer.PeerState.UNKNOWN;
if ("started".equals(event)) {
peer = new Tr... |
1a1f066a-fcf1-42f8-8922-c86bff8643a2 | 2 | int[][] get_table_copy_for_unit_testing() {
final int[][] t = new int[256][8];
for (int i = 0 ; i < t.length ; ++i) {
for (int j = 0 ; j < t[i].length ; ++j) {
t[i][j] = table[i][j];
}
}
return t;
} |
33c7a24a-0439-4b91-9710-773bcfdca113 | 0 | public AutomatonPane initAutomatonPane() {
AutomatonPane apane = new AutomatonPane(automatonDrawer);
gui.SuperMouseAdapter a = new ArrowMinimizeTool(apane, automatonDrawer);
apane.addMouseListener(a);
apane.addMouseMotionListener(a);
return apane;
} |
fb9c90b8-cd89-493a-9baa-baaaa9587870 | 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... |
1abf844b-d053-4a36-926d-64c211dcd0d9 | 0 | private Bank1(){} |
6b394e5c-df50-47c3-af1b-0a7355f65381 | 2 | protected void connectTiles(Tile tile1, Direction direction1, Tile tile2, Direction direction2){
if(tile1 != null) tile1.setEdge(direction1, this);
if(tile2 != null) tile2.setEdge(direction2, this);
} |
27c801d3-e77e-4158-abff-9552f2a9a95e | 3 | private void doEditGS(HttpServletRequest request, HttpServletResponse response, boolean isEditUser) throws ServletException, IOException {
String yitouGSId = StringUtil.toString(request.getParameter("yitouGSId"));
if(!StringUtil.isEmpty(yitouGSId)) {
YiTouGS yiTouGS = null;
... |
cfe406cb-9674-4fa7-8c22-4f6cc85e5815 | 1 | public void inputAll( float delta )
{
input( delta );
for ( GameObject child : children )
child.inputAll( delta );
} |
e4799f75-8c2b-4bb0-9554-40ce28850413 | 8 | @Override
public Area unpackAreaObjectFromXML(String xml) throws CMException
{
List<XMLLibrary.XMLTag> aV=CMLib.xml().parseAllXML(xml);
if(aV==null)
throw new CMException(unpackErr("Area","null 'xml'"));
aV=CMLib.xml().getContentsFromPieces(aV,"AREA");
if(aV==null)
throw new CMException(unpackErr("Area"... |
58401c70-d875-4af7-8dc0-241cfb25225b | 9 | public void testSong(Song pSong) {
Audio audio = null;
try {
audio = pSong.getAudio();
}
catch (MusicPlayerException e) {
fail( "couldn't initialize BasicPlaybackAudio" );
}
try {
audio.open();
assertTrue( audio.getAudioFormat() != null );
}
catch (AudioException e) {
fail( "couldn't open... |
504e77c6-d194-4a2c-b349-d86e273f1afa | 1 | public static void optimizeCFG(final FlowGraph cfg) {
final List blocks = cfg.preOrder();
for (final Iterator it = blocks.iterator(); it.hasNext();) {
((Block) it.next()).stackOptimizer().optimize();
}
} |
5fb7bd52-ae26-4e5f-af70-cc2980bb174b | 6 | @ Override
public int compare(File lhs, File rhs)
{
if (lhs.isDirectory () && !rhs.isDirectory ()) {
if (order == FileFolderOrder.DIRECTORY_FIRST)
return -1; // list directories first
else
return 1; // list directories last
} else if ( !lhs.isDirectory () && rhs.isDirectory ())
if (order == FileF... |
9d6f47fb-af78-49d6-b411-2cc49554e658 | 9 | static public void exportXLS(String fname, DataFrame dataframe) throws FileNotFoundException, IOException{
Workbook wb = new HSSFWorkbook();
Sheet sheet = wb.createSheet("data");
Row row = sheet.createRow((short)0);
short col = 0;
ArrayList<String> vnames = dataframe.getNames()... |
885fb30b-e2f2-4e1f-b81a-f086ce97ebaf | 3 | void remove() {
try {
Service service;
int i;
int option;
UI.printHeader();
System.out.println(services.size() + " servicios activos:");
System.out.println("");
for (i = 0; i < services.size(); i++) {
service = services.get(i);
System.out.println((i + 1) + ") Servicio: "
+ servic... |
5e205a78-f6fc-40ed-a32d-a214a93bcbe1 | 8 | @Override
public void readObject( DataInput in ) throws IOException {
super.readObject( in );
Texture attr = (Texture)node;
attr.setBoundaryColor( control.readColor4f( in ));
attr.setBoundaryModeS( in.readInt() );
attr.setBoundaryModeT( in.readInt() );
attr.setEnable(... |
4d67f0cf-bf1d-409e-87b4-5b4406948747 | 8 | private Map<String, BoundField> getBoundFields(Gson context, TypeToken<?> type, Class<?> raw) {
Map<String, BoundField> result = new LinkedHashMap<String, BoundField>();
if (raw.isInterface()) {
return result;
}
Type declaredType = type.getType();
while (raw != Object.class) {
Field[] f... |
5c616ce6-85d1-4cc2-82b7-59602dc0d093 | 0 | @Test
public void testGetDirection() throws IOException {
System.out.println("getDirection");
AntBrain b = new AntBrain("cleverbrain1.brain");
Ant instance = new Ant(b,true,0);
int expResult = 0;
int result = instance.getDirection();
assertEquals(expResult, r... |
c44d4e2e-23d1-4486-af34-23212a17a24f | 6 | public static boolean checkAnagram(String parent, String query) {
int i = 0;
int j = 0;
if (parent == null || query == null) {
return false;
}
while (i < parent.length() && j < query.length()) {
if (parent.indexOf(query.charAt(j)) < 0 || query.indexOf(par... |
9aab38b3-6d34-476d-bd98-096f5add8cc4 | 2 | public void addTask(Task task) {
if (queue.size() <= MAXQSIZE) {
Logger.getInstance().debug("QSize is: " + queue.size() + "; Now Pushed task " + task.toString());
queue.add(task);
Logger.getInstance().debug("QSize is: " + queue.size());
} else {
Logger.... |
63615485-6055-4624-84fb-91f1581afdc6 | 8 | public static void main(String argv[]) {
try {
//check params
if (argv.length < 6) printHelp();
//read parameters
inputDir = argv[0];
host = argv[1];
port = Integer.valueOf(argv[2]);
int interval = Integer.valueOf(argv[3]);
... |
a2681733-98bd-4697-a1e4-3ed476f85b0d | 5 | public int[][] minMax() {
int minMaxValues[][] = new int[2][2], j; // [X/Y][Min/Max]
Vecteur<Integer>[] tempTabVec;
tempTabVec = getPoints();
j = 0;
minMaxValues[0][0] = minMaxValues[0][1] = tempTabVec[j].get(0);
minMaxValues[1][0] = minMaxValues[1][1] = tempTabVec[j].get... |
ba2ac507-2d22-4ce0-a882-b74bc5147704 | 8 | public void createActions() { //create the action objects that are used when arrow keys are pressed
UpAction = new AbstractAction("Move Up") {
public void actionPerformed(ActionEvent e)
{
if (board.isValid("up") && board.validMove) {
board.move("up");
board.newRandomTil... |
95985446-3e65-468a-92e1-79bb6821250e | 3 | public static List<Intersection> getStarPoints(int boardSize) {
List<Intersection> starPoints = new ArrayList<Intersection>();
if (boardSize == 9) {
starPoints.addAll(Arrays.asList(star(2, 2), star(2, 4), star(2, 6), star(4, 2), star(4, 4), star(4, 6), star(6, 2), star(6, 4), star(6, 6)));
} else if (boardSize... |
b64fdeb0-f831-4ed9-8817-dc6adc0e49a1 | 3 | public Point getXY() {
if (getPosition() == Position.left) {
return new Point(getParent().getX(), getParent().getY()
+ getParent().getHeight() / 2);
} else if (getPosition() == Position.right) {
return new Point(getParent().getX() + getParent().getWidth(),
getParent().getY() + getParent().getHeight(... |
c2864164-0884-483e-9f61-133f02acb6fd | 8 | private void processLogin4Msg(byte[] pktBuffer, DatagramPacket rcvPkt,
String clientIP) {
try {
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(
pktBuffer));
dis.readByte();
int length = dis.readInt();
byte[] encUserNamebyte = new byte[length];
dis.read(encUserNamebyte);
... |
f7431c32-1102-47fb-b389-14a18b7be0f2 | 8 | private static int returnLargest(final int A, final int B, final int C) {
if (A == B && A == C) {
return A;
} else if (A > B && A > C) {
return A;
} else if (B > A && B > C) {
return B;
} else if (C > A && C > B) {
return C;
}
... |
e8b6a6a5-d764-44e9-93ea-121b86321dbf | 2 | public void setEditMemoryAction(ActionListener l) {
final ActionListener[] originalActionListeners = editMemoryButton.getActionListeners();
for (ActionListener actionListener : originalActionListeners) {
editMemoryButton.removeActionListener(actionListener);
}
editMemoryButto... |
5523c799-577b-43ea-b67f-0b3b2baf8b9e | 9 | public MOB getAWitnessHere(Room R, MOB accused)
{
if(R!=null)
for(int i=0;i<R.numInhabitants();i++)
{
final MOB M=R.fetchInhabitant(i);
if((M!=null)
&&M.isMonster()
&&(M!=accused)
&&(M.charStats().getStat(CharStats.STAT_INTELLIGENCE)>3)
&&(CMLib.dice().rollPercentage()<=(CMLib.flags().isEvil(ac... |
4f5cf027-be51-44da-99a4-59caf95c839e | 9 | @Test(groups = { "tck" })
public void test_factory_string_hours_minutes_noColon() {
for (int i = -17; i <= 17; i++) {
for (int j = -59; j <= 59; j++) {
if ((i < 0 && j <= 0) || (i > 0 && j >= 0) || i == 0) {
String str = (i < 0 || j < 0 ? "-" : "+") + Integer.toString(Math.abs(i) + 100).s... |
d9b315a2-c1ad-4597-adf6-8d17b8764a66 | 2 | public void setCode(final List v) {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
if (ClassEditor.DEBUG) {
System.out.println("Setting code to " + v.size() + " instructions");
Thread.dumpStack();
... |
4e52f458-861a-486a-8382-6c1f95313bc3 | 5 | */
private static ArrayList<Vertex> readGraphFromFile()
{
ArrayList<Vertex> vertexArray = new ArrayList<Vertex>();
FileInputStream fstream = null;
try
{
fstream = new FileInputStream("dijkstraData.txt");
// Get the object of DataInputStream
D... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.