method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1031384c-d4cf-4747-8407-07a4e2ea46cf | 1 | public synchronized void stop(){
listening=false;
try {
is.close();
con.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("handler stopping");
} |
e113f365-2879-4800-b2fb-2b63bc4e7a57 | 2 | @Override
public void focusLost(FocusEvent evt) {
if (evt.getSource().equals(tripFormFileNameLabel)) {
MainWindow.setupData.setFormFileName (tripFormFileNameLabel.getText());
}
if (evt.getSource().equals(dataFileFileNameLabel)) {
MainWindow.setupData.setDataFileName (dataFileFileNameLabel.getText());... |
3834680b-7670-4e22-b623-c16003254977 | 7 | @Test
public void testEj2_e(){
final int max = 10;
final Grafo grafo = new Grafo(max);
for (int i = 0; i < max; i++)
grafo.agregarCiudad(CIUDADES.get(i));
final List<Vuelo> todosVuelos = new ArrayList<Vuelo>();
final Vuelo vuelo1 = new Vuelo(CIUDADES.get(1), CIUDADES.get(3), 100);
final Vuelo vuelo2 = n... |
3cc536e5-a886-4c8f-9bb2-030a520f040d | 7 | public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) {
return size;
}
size = 0;
final boolean isMessageSet =
getDescriptorForType().getOptions().getMessageSetWireFormat();
for (final Map.Entry<FieldDescriptor, Object> entry :
getAllFields().entrySet()... |
e57c2b22-d9d5-454e-ae64-be51cfb8856d | 6 | public static void analyzePath(String path) {
File name = new File(path);
if(name.exists()) {
System.out.println(""+name.getName()+"\n"
+ "exists "+(name.isFile() ? "is a file": "is not a file")+"\n"
+ ""+(name.isDirectory() ? "is a directory"... |
68b84b37-68e6-4152-b6ca-010321ecb381 | 3 | private void readFile(InputStream in, File outFolder) throws IOException {
log.trace("Reading packaged file");
int dataSize = readInt(in);
String fileName = readString(in);
log.trace("Filename: " + fileName + " ("+dataSize+"b)");
File outFile = new File( outFolder, fileName );
outFile.getParentFil... |
4cfe8669-726d-47ee-b5e3-fa6ee94a5e40 | 2 | public double doubleValue() // returns Double type value of data N,F
{
String s = value.trim();
return ( s.length()==0 || s.indexOf("*")>=0 ? 0 : Double.parseDouble(s) );
} |
ea1f923c-78fc-4e2e-b8eb-76c662cd2021 | 4 | private void handleMouseEvent(final MouseEvent MOUSE_EVENT) {
final Object SRC = MOUSE_EVENT.getSource();
final EventType TYPE = MOUSE_EVENT.getEventType();
if (SRC.equals(targetIndicator)) {
if (MouseEvent.MOUSE_PRESSED == TYPE) {
userAction = true;
... |
773efaca-e089-48a6-9a3a-12d5f2174268 | 2 | public Object process(Cache highLevelCache) {
if (isHighLevelCacheEnable()) {
try {
Object result = doInCache(highLevelCache);
setHighLevelCacheEnable();
return result;
} catch (CacheUnreachableException e) {
setHighLevelCacheDisable();
}
}
return null;
} |
65d486b9-4321-42ed-95b9-b02ed7ff958b | 4 | public static void concatenateFile(String... filename) {
String str = null;
// use try-with-resources
// so no need to worry about closing the resources
try (BufferedWriter writer = new BufferedWriter(new FileWriter(
"CombinedFile.txt"));) {
for (String name : filename) {
try (BufferedReader reader ... |
5f68c918-ad15-47dc-8f88-e0c9f0c76277 | 0 | protected void initDefaultCommand() {
setDefaultCommand(new SetModeMoving());
} |
b9e18fdc-75a9-4947-a07c-b673f22d979d | 9 | public static Tile nearestOpenTile(Monster movingMonster, char direction){
char left=direction;
char right=direction;
while(!canMove(movingMonster, direction)){
switch(randGenerator.nextInt(2)){ //at random, choose one of two actions:
case(0): //action 1: try moving left. otherwise, move right.
lef... |
e9c44fc1-d638-495d-b83c-6e4c2a82cd45 | 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... |
383e6bd7-acf8-477f-83d4-641265c18cbd | 3 | @Override
public int[] decodeQuality(String quality) throws QualityFormatException {
int[] qual = new int[quality.length()];
for (int i = 0; i < qual.length; i++) {
int c = quality.charAt(i);
int q = c - encoding.getOffset();
if ((q < encoding.lowerBound) || (q > encoding.upperBoud)) {
throw new Quali... |
7bdab3ea-681d-4055-bde9-71f20968bb93 | 5 | public static void sendSay(MapleCharacter player, String msg) {
MaplePacket packet;
switch (player.getGMLevel()) {
case 0:
packet = MaplePacketCreator.serverNotice(5, "[Rookie ~ " + player.getName() + "] " + msg);
break;
case 1:
pac... |
256cf881-e797-470b-9d6c-c26b78cca6cf | 1 | synchronized public static ProcessManager getInstance() {
if (singleton == null) {
singleton = new ProcessManager();
}
return singleton;
} |
419abc5a-90f5-4d86-b791-8607c72b8448 | 9 | @Override
public void callback(DiscreteEventSimulator DES) throws SimulatorException {
// Currently, the presence of a guest thread *always* preempts the native thread
Machine machine = context.sim.getMachine();
CoreModel coreModel = machine.getCore(context);
// Quit trying to simulate if disabled.
if ... |
0108d6f9-2dcb-4444-9228-82a60d17de75 | 0 | @Override
public void move() {
super.move();
this.age += 1;
} |
c3496885-b1ae-4483-a069-6d99c166c3b6 | 6 | private static void expandNode (final Problem problem, final Node node,
final PriorityQueue<Node> frontier, final HashSet<Object> explored) {
// Get all successors of the node.
final List<Successor> successorSet =
problem.getSuccessors(node.getState());
for (Successor... |
568f1096-f2a0-45b9-80dc-ff9a261cee21 | 9 | public void deleteOldValues(final long now) {
this.checkTime(now);
final long minTime = now - this.windowLength;
boolean deleted = false;
while (this.size > 0) {
if (this.times[this.ringTail] < minTime) {
final float value = this.values[this.ringTail];
this.delete();
deleted = true;
... |
4716db82-657d-4c2c-9acb-1b9d432e502c | 8 | private boolean[] checkNeighbours(int row, int col) {
boolean isUp = false;
boolean isDown = false;
boolean isLeft = false;
boolean isRight = false;
if (row == 0) {
isDown = true;
}
if (col == 0) {
isRight = true;
}
if (row == this.getFieldWidth() - 1) {
isUp = true;
isDown = false;
}... |
3af2adfd-21ee-4ce3-93eb-adba81688a94 | 9 | public String getData(String email){
JSONArray result = new JSONArray();
ResultSet resultSet = null;
try {
// Get Connection and Statement
connection = dataSource.getConnection();
statement = connection.createStatement();
String query2 = "select * from usuarios where email= '" + email
+ "'... |
cfa149d9-6e04-46e6-a12f-c7bcb52cc694 | 2 | public static String lookupColumnName(ResultSetMetaData resultSetMetaData, int columnIndex) throws SQLException {
String name = resultSetMetaData.getColumnLabel(columnIndex);
if (name == null || name.length() < 1) {
name = resultSetMetaData.getColumnName(columnIndex);
}
return name;
} |
12b3769f-472c-4f6d-85a9-000aedd80fb7 | 2 | public static DisplayMode getPreferredDisplay() throws LWJGLException {
DisplayMode chosen = Display.getDisplayMode();
DisplayMode[] modes = Display.getAvailableDisplayModes();
for(DisplayMode display : modes){
if(isDisplayModeBetter(chosen, display) == true){
chose... |
fc0a9cba-be1c-4a95-89d6-fd01143400e4 | 4 | private static int toIndex(Direction dir) {
switch(dir) {
case SOUTH: return 0;
case NORTH: return 1;
case WEST: return 2;
case EAST: return 3;
}
return 0;
} |
b851b879-392e-4484-bc97-799c6d2428eb | 5 | @Override
public boolean init(List<String> argumentList, DebuggerVirtualMachine dvm) {
breakpointLinesToSet = new ArrayList<String>();
breakableLineNumbers = new ArrayList<String>();
for (int i = 1; i < dvm.getSourceLinesSize(); i++) {
if (dvm.isBreakableLine(i)) {
... |
c6509fb5-90cf-4329-b7d8-86cde4de74cc | 5 | private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker... |
3e743ec7-b034-438c-926e-49e3f2852bfd | 2 | private boolean userInputChecker(String userInput)
{
boolean matchesInput = false;
for (int loopCount = 0; loopCount < userInputList.size(); loopCount++)
{
if (userInput.equalsIgnoreCase(userInputList.get(loopCount)))
{
matchesInput = true;
userInputList.remove(loopCount);
loopCount--;
}
... |
9710657a-0985-47f8-ab68-c02d08ab82db | 5 | protected void do_button_actionPerformed(ActionEvent e)
throws UnknownHostException, IOException, InterruptedException {
String ip = textIpRede.getText();
if (ip.length() < 4) {
JOptionPane.showMessageDialog(null, "Informe um IP válido!");
} else {
try {
Utils utils = new Utils();
InputStream pi... |
649b7ccd-54d1-409c-ac0a-63f698a751d0 | 7 | static void draw_edges(List<AsciiEdge> edges, List<String> nodeline, List<String> interline) {
int index = 0;
for (AsciiEdge edge : edges) {
if (edge.mStart == edge.mEnd + 1) {
interline.set(2 * edge.mEnd + 1, "/");
} else if (edge.mStart == edge.mEnd - 1) {
... |
1f8e0889-d1d6-441b-92eb-62c87732f087 | 3 | private static boolean equals(byte[] foo, byte[] bar){
if(foo.length!=bar.length)return false;
for(int i=0; i<foo.length; i++){
if(foo[i]!=bar[i])return false;
}
return true;
} |
4d04fe7e-015f-4be9-9f4a-a1b580e8db13 | 5 | public int countRows(String query) {
ResultSet rs = null;
int rowCount = 0;
try {
Statement statement = conn.createStatement();
// select the number of rows in the table
rs = statement.executeQuery(query);
// get the number of rows from the result ... |
8844e453-d26d-405d-b1e5-841261248a9e | 2 | public E dequeue() {
if (dequeue >= 0 && dequeue < queue.getSize()) {
final E returnValue = (E) queue.get(dequeue);
dequeue++;
return returnValue;
} else {
return null;
}
} |
0d2a83d3-868a-4f25-8bcc-33f7aec531e0 | 7 | public static Matrix read(Configuration conf, Path... modelPaths) throws IOException {
int numRows = -1;
int numCols = -1;
boolean sparse = false;
List<Pair<Integer, Vector>> rows = Lists.newArrayList();
for(Path modelPath : modelPaths) {
for(Pair<IntWritable, VectorWritable> row :
n... |
8d0a72e5-b695-4147-9192-2aa6e74783dc | 3 | public void actionPerformed (ActionEvent e)
{
// On test si le pseudo fait un minimum 3 caractere et s'il est disponible via
// program.availableNickname
if (nickname.getText().length() > 2 && program.availableNickname(nickname.getText()))
{
program.setNickname(nickname.getText());
// On envoi un signa... |
7c4949eb-2763-4d3c-a6bf-6b09e17908db | 3 | private Object[][][] toCompressedArray(List<Locatable>[][] grid) {
Object[][][] newGrid = new Object[this.xNumCells][this.yNumCells][];
for (int xi = 0; xi < grid.length; xi++) {
List<Locatable>[] xar = grid[xi];
for (int yi = 0; yi < xar.length; yi++) {
... |
2c7c7027-680a-47f6-94d9-4e0e8ec08a9f | 2 | private final String htmlFilter( String line )
{
if ( line == null || line.equals( "" ) )
{
return "";
}
line = replace( line, "&", "&" );
line = replace( line, "<", "<" );
line = replace( line, ">", ">" );
line = replace( line, "\\\\", "... |
53cf012c-5d68-4c39-a50e-f895a442edca | 5 | private Object lookupItem(String pattern) {
Object selectedItem = model.getSelectedItem();
// only search for a different item if the currently selected does not match
if (selectedItem != null && startsWithIgnoreCase(selectedItem.toString(), pattern)) {
return selectedItem;
}... |
378fbcb5-ea21-44a9-bbdc-013bd6eb9dcb | 8 | public String preReportBySubmitted() {
List<ClassObj> lstClass = mdClass.getAll();
List<ObjectiveObj> lstObjective = mdObjective.getAll();
List<TopicObj> lstTopic = new LinkedList<TopicObj>();
if(lstObjective.size() > 0){
lstTopic = mdTopic.getByObjective(lstObjective.get(0).... |
3549d8f0-1aab-41aa-90b8-1cb29109fddc | 8 | public void setSelected(MoleculeComponent e)
{
System.out.println(">>>>>>>>> Set selected called for " + e);
if (e == null) // If null, clear selection
{
if (selected != null) {
if (selected.getClass() == Element.class) {
elements.get(selected.getKey()).setSelected(false); // set the internal selec... |
02b7e7d3-6052-46be-af1e-60ef24d055e3 | 3 | public Scoreboard(GUIComponentGroup superGroup) {
super(superGroup);
winnerText = new TextComponent(this, "You Win!");
winnerText.setFont(GraphicalFont.HugeFont);
winnerText.setAlignment(TextComponent.H_CENTER, TextComponent.V_CENTER);
winnerText.setBounds(this.getLocationX(), ... |
0003a085-8e1a-4fe4-9b61-1c064ad0409e | 6 | @Override
public void paint(Graphics g) {
super.paint(g);
int dDibuixRobot = 30;
int dRec = 10;
int dGetL = 60;
int dGetB = 35;
int dGetBd = 42;
int dBpro = 30;
int dBpro2 = dBpro-2;
int dBliv = 49;
int dBrec ... |
64acb7f7-2d43-4d3c-a6a5-10ee7fc812ed | 6 | @SuppressWarnings("rawtypes")
public Validator createValidator(final Annotation annotation)
{
try
{
final Object validatorValue = ReflectionUtils.getAnnotationValue(
annotation, "validator");
/*
* Validator attribute exists on annotation, so try to instantiate
* it and create a validator. If t... |
4964cb52-59bd-4d2f-8a38-b781a71b2441 | 7 | public ArrayList<String> getTxtContent(File file){
ArrayList<String> txtList=new ArrayList<String>();
if ((!file.exists())||file==null) {
return txtList;
}
String line=null;
System.out.println(file);
File[] files=file.listFiles();
if (files==null||files.length==0) {
return txtList;
}
for (int i... |
39c3c2f6-0527-4d35-9c09-bbb99982d0fe | 3 | public List<String> playerWorlds(Player player){
List<String> worldList = new ArrayList<String>();
for (String worldN : plugin.mainWorlds){
String worldName = worldN + "_" + player.getName();
String currentdir = plugin.minecraft_folder;
File folder = new File(currentdir + "/inactive/" + worldName);
F... |
560d6580-601d-4643-aed4-65f73688d099 | 9 | @Override
public void onMessage(MutableWebSocketFrame aFrame, WebSocketContext aContext) {
SocketIoMessage message = decoder.decode(aFrame);
if (LOG.isDebugEnabled()) {
if (SocketIoMessage.Type.EVENT.equals(message.type) && message.data != null) {
final JsonElement event ... |
6a2da5e4-a53c-4139-a108-4c83cae976d4 | 0 | public String getIp() {
return this.ip;
} |
17af2282-35c9-4fac-bcb4-f3d074cb1749 | 2 | private void jList1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jList1KeyPressed
if (evt.getKeyCode() == KeyEvent.VK_ESCAPE && jList1.getSelectedValue() != null) {
logger.log(Level.INFO, "Resetting backup selection...");
jList1.clearSelection();
}
}... |
e3656d2e-3c75-49db-817a-a8756c9170b9 | 4 | private void btn_loginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_loginActionPerformed
String id, senha;
id = txt_id.getText();
senha = txt_senha.getText();
if(id.isEmpty() || senha.isEmpty()){
JOptionPane.showMessageDialo... |
476f18f4-5ee2-4ef0-bcff-2aafb210846b | 7 | public CheckController1(File file) {
String fileType = file.getName().split("\\.")[0].split("_")[0];
int fileNameSectionNumber = file.getName().split("\\.")[0].split("_").length;
try {
checkReport1 = new CheckReport1(file);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();... |
fdd69f54-cfc7-404c-ba5c-d2accb04af99 | 5 | public Warehouse getWarehouse(long itemid, int branchid)
{
Warehouse warehouse = null;
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbC... |
c3b919e9-ef16-4f2e-a0d4-08176c7407c6 | 4 | private ArrayList<String> getTreeLeafs(){
ArrayList<String> leafs = new ArrayList<>();
for(ArrayList<String> valueList : _tree.values()){
for(String value : valueList){
if(_tree.containsKey(value)) continue;
if(leafs.contains(value)) continue;
leafs.add(value);
}
}
return leafs;
} |
737c1bd8-0dce-4cd9-98b5-9c6e5442b2da | 8 | private boolean getTWSUserNameAndPasswordFromArguments(String[] args) {
if (isFIX()) {
if (args.length == 5 || args.length == 6) {
IBAPIUserName = args[3];
IBAPIPassword = args[4];
return true;
} else {
return false;
... |
d7464554-43b1-4250-bceb-ab575878f55e | 2 | public static void main(String[] args){
Boat.createBoat("RaceBoat");
Boat boat = Boat.getInstance();
for(int i = 90; i<=270; i+=10){
try{
System.out.print("Setting rudder to " + i + " degrees.");
boat.com.sendMessage("set rudder " + i);
Thread.sleep(1000);
}catch(Exception e){
e.printStac... |
10e2e72d-cb68-4c6b-9a37-dffb3a56b174 | 9 | final void method996(int i, int i_86_, int i_87_, int i_88_, boolean bool, int i_89_, boolean bool_90_) {
anInt1151++;
int i_91_ = 256;
if (bool_90_) {
i_91_ |= 0x20000;
}
if (bool) {
i_91_ |= 0x40000000;
}
i_88_ -= anInt1135;
if (i_87_ == 1) {
i -= anInt1139;
for (int i_92_ = i; (i_92_ ^ 0x... |
a7730d5a-23ee-4844-a33f-8fbd3dac218d | 9 | public static Obligation getInstance(Node root) throws ParsingException {
URI id;
int fulfillOn = -1;
List assignments = new ArrayList();
AttributeFactory attrFactory = AttributeFactory.getInstance();
NamedNodeMap attrs = root.getAttributes();
try {
id = new... |
262d1381-793b-4846-873f-aa4e84a56638 | 6 | public PropertyList lookupHandler(String path) {
{ HttpServer server = this;
if (Http.$HTTP_SERVER_IMPLEMENTATION$ == null) {
throw ((StellaException)(StellaException.newStellaException("lookup-handler: no HTTP server implementation loaded").fillInStackTrace()));
}
{ PropertyList handler ... |
9befbf76-7e32-4a09-ab69-ce4a82312518 | 9 | public final void with_stmt() throws RecognitionException {
try {
// Python.g:274:10: ( 'with' test ( with_var )? COLON suite )
// Python.g:274:12: 'with' test ( with_var )? COLON suite
{
match(input,96,FOLLOW_96_in_with_stmt2191); if (state.failed) return;
pushFollow(FOLLOW_test_in_with_stmt2193);
... |
3c2f33f7-42c5-4b24-970e-028244c4a616 | 8 | @SuppressWarnings("unchecked")
public void initializeConfigValues()
{
Ore_Gin_Properties = new HashMap<Integer,OreGinProperties>();
Cloaker_Properties = new HashMap<Integer,CloakerProperties>();
//Load general config
MachineFactoryPlugin.CITADEL_ENABLED = getConfig().getBoolean("general.citadel_enabled");
... |
9ae532c2-8c5b-45e6-be74-6550abe57a79 | 9 | public static Object getObject( Object in )
{
// do not record -- only called from other methods
if( !(in instanceof String) )
{
return in;
}
String input = String.valueOf( in );
Object ret = input; // default is the original string
try
{
ret = new Double( input );
return ret;
}
catch( N... |
3e4dbaa1-8bf4-44c5-939d-55449ed223d6 | 6 | public void wyslijWiadomosc(String _wiadomosc, String _typWiadomosci)
{
try {
if(socket != null)
out = new PrintWriter(socket.getOutputStream());
} catch (IOException e) {System.out.println("Błąd WysWiad: "+e.getMessage());
} ... |
55c4016a-c401-4a18-9496-e26f396a8c8e | 9 | public void run()
{
DNSOutgoing out = null;
try
{
// send probes for JmDNS itself
if (this.jmDNSImpl.getState() == taskState)
{
if (out == null)
{
out = new DNSOutgoing(DNSConstants.FLAGS_QR_RESPONSE | DN... |
26194f32-a3e0-43d8-b303-57309d903413 | 5 | public void setInputParamInteger(final int paramIndex, final Object array) throws IllegalArgumentException, NullPointerException {
if (array==null) throw new NullPointerException(ARRAY_IS_NULL);
InputParameterInfo param = getInputParameterInfo(paramIndex);
if ((param==null) || (param.type()!=Inp... |
ea7b193f-a9a2-4a48-87cb-81581dc37309 | 2 | private String getDirectory() {
if ((config.getDirectory() == null) || (config.getDirectory().isEmpty())) return "logfiles/";
else return config.getDirectory() + "/";
} |
8f1f04c9-15dc-40b8-a031-7cd1ba84cc10 | 2 | @PostConstruct
@Schedule( year="*", dayOfWeek="*" , hour="*" , minute="*/5" , persistent=false )
@Timeout
@AccessTimeout(unit=TimeUnit.MINUTES, value=1)
private void loadFeaturedItem(Timer timer){
System.out.println(" #### Iniciando el FeaturedItemBean.loadFeaturedItem() ");
this.featuredItems = new Array... |
1e5f0299-9d84-438a-a32c-3bf23139bb70 | 6 | private void registerNew() {
if (registerQueue.isEmpty())
return;
Selector selector = this.selector;
for (;;) {
RegistrationRequest req = registerQueue.poll();
if (req == null)
break;
DatagramSessionImpl session = new DatagramSes... |
00ba65cc-a78c-49de-898e-49ad261a0ccf | 1 | private boolean jj_2_51(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_51(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(50, xla); }
} |
9d736549-f535-4fa6-8996-1d43a745c3eb | 5 | private void connect() {
do {
try {
connection = (TACConnection) Class.forName(connectionClassName).
newInstance();
} catch (Exception e) {
log.log(Level.SEVERE, "could not create TACConnection object of class "
+ connectionClassName, e);
fatalError("no TACConnection available");
}
... |
87d5da72-f653-4c4c-b5cd-5922ec533eef | 6 | @AfterTest
@Test(groups = "Deletion")
public void testRandomBSTDeletion() throws KeyNotFoundException,
EmptyCollectionException {
Reporter.log("[ ** Random BST Deletion ** ]\n");
Integer count = 0;
timeKeeper = System.currentTimeMillis();
for (Integer i = -seed; i < 0; i++) {
try {
randomBST.del... |
d8f9946a-4839-420f-90fa-60493e014da5 | 9 | public static void startupUtilitiesSystem() {
synchronized (Stella.$BOOTSTRAP_LOCK$) {
if (Stella.currentStartupTimePhaseP(0)) {
if (!(Stella.systemStartedUpP("stella", "/STELLA"))) {
StartupStellaSystem.startupStellaSystem();
}
}
if (Stella.currentStartupTimePhaseP(1)) {... |
8c8af9f0-ae94-4417-ae4f-1e9cb70d0dbb | 5 | public Method findMethod(String prefix, String methodName, Class<?> ... paramType) {
if(methodName == null || methodName.isEmpty())
return null;
methodName = createMethodName(prefix, methodName);
try {
return getInspectedClass().getDeclaredMethod(methodName, paramType);
} catch (SecurityException e) {
... |
41a1fe92-946c-48bb-b4c6-1b63b78bf5e4 | 3 | public void visitLocalExpr(final LocalExpr expr) {
if (expr.fromStack()) {
print("T");
} else {
print("L");
}
print(expr.type().shortName().toLowerCase());
print(Integer.toString(expr.index()));
final DefExpr def = expr.def();
if ((def == null) || (def.version() == -1)) {
print("_undef");
}... |
c1326f2a-4d00-445e-987d-156c70c35928 | 3 | public void update() {
statusPanel.setText(status.getText());
repaint();
if(player.hasWon() && !player.getWinnerMessageHasBeenShown() && !grid.getIsTest()){
showWinMessage();
}
} |
176deac1-d300-43ba-b999-9def608370d3 | 4 | public boolean unequip(final int... ids) {
// Disable when bank open
if (ctx.bank.opened()) {
return false;
}
if (ctx.hud.open(Hud.Window.WORN_EQUIPMENT)) {
final Item item = ctx.equipment.select().id(ids).poll();
if (item.valid()) {
if (item.interact("Remove")) {
return Condition.wait(new Ca... |
f4813382-5884-4bf8-8155-42aa44a24aef | 6 | private String scanDirectiveIgnoredLine(Mark startMark) {
// See the specification for details.
int ff = 0;
while (reader.peek(ff) == ' ') {
ff++;
}
if (ff > 0) {
reader.forward(ff);
}
if (reader.peek() == '#') {
ff = 0;
... |
e3b465c2-6694-464c-b322-fc42566290be | 9 | private void showEduFw() {
content = null;
head = null;
Object fb = logic.showEduFwHead();
if (fb instanceof Feedback) {
JOptionPane.showMessageDialog(null, ((Feedback) fb).getContent());
} else if (fb instanceof String[]) {
head = (String[]) fb;
fb = logic.showEduFwContent();
if ((fb instanceof ... |
2b6a4926-0760-424d-8436-bc81c2fdd5e5 | 8 | public static int getLevenshteinDistance(String s, String t) {
if (s == null || t == null) {
throw new IllegalArgumentException("Strings must not be null");
}
/*
The difference between this impl. and the previous is that, rather
than creating and retaining a matrix of size s.length()+1 by t.length()+1,
... |
24a41458-b5df-47c9-a067-3ab398122e80 | 1 | public EncryptedHand decyrptEncHand(EncryptedHand hand)
throws InvalidKeyException, IllegalBlockSizeException,
BadPaddingException {
EncryptedHand ret = new EncryptedHand();
for (int i = 0; i < Hand.NUM_CARDS; i++) {
EncryptedCard tmp = hand.data.get(i);
ret.data.add(decryptEncCard(tmp));
}
retur... |
dda77882-cf13-4f7f-afbf-c210c546e214 | 7 | public static boolean isInteger(String str) {
if (str == null) {
return false;
}
int length = str.length();
if (length == 0) {
return false;
}
int i = 0;
if (str.charAt(0) == '-') {
if (length == 1) {
return false;
}
i = 1;
}
for (; i < length; i++) {
char c = str.charAt(i);
i... |
3bc5bba0-061e-4235-8e10-685d4b71513e | 3 | public void save() {
if (config == null || file == null) {
return;
}
try {
get().save(file);
} catch (IOException ex) {
InstaScatter.ins.getLogger().log(Level.SEVERE, "Could not save config to " + file, ex);
}
} |
e9f5d0f0-7d8a-4e94-ac29-6dfb269b8df5 | 2 | public String printTree(int depth) {
String print = "";
for (int i = 0; i < depth; i++) {
print = print + " ";
}
print = print + toString() + "\n";
Binomialnode a = child;
while (a != null) {
print = print + a.printTree(depth + 1);
a... |
5dfc93a1-93cd-483a-9b01-dc50a0109938 | 3 | @Override
public Key next() {
if (!hasNext())
throw new NoSuchElementException();
Node node = stack.pop();
if (node.right != null)
stack.push(node.right);
if (node.left != null)
stack.push(node.left);
return node.key;
} |
3392d9e9-cce1-4a73-9c9d-e751adeb36cb | 7 | public void removeByFileName(String song) {
if(playList != null) {
GameSong gs;
for(int i = 0; i < playList.size(); i++) {
gs = playList.get(i);
if(gs.getFilePath().equals(song)) {
if(currentSongIndex == i) {
if(... |
eaba3f13-8029-431f-b17f-c6fc6fc52b1d | 5 | public synchronized void threadInc(SimThread t, DataHolder d) {
if (Constants.muCheck) {
if ((Constants.muIncS += Constants.muIncUp) < .75) {
t.Constants._epsilon = this.epsilon;
t.Constants._SIM_epsilon_start = this.epsilon;
t.Constants._SIM_epsilon_final = this.epsilon;
t.setRunNum(runNum);
r... |
cdde2ea5-4406-4e6d-92a7-11aeb8bc24b0 | 2 | public Meeting getMeeting(int id)
{
MeetingImpl tempM = null;
for(Meeting m : meetingList)
{
tempM = (MeetingImpl) m;
if(tempM.meetingID==id)
{
return m;
}
}
return null;
} |
d88fbc88-7110-41ea-97d7-53b16c7bb841 | 9 | public LongCount(int bak, int kat, int tun, int win, int ki)
{
if(bak < 0)
{
throw new IllegalArgumentException("Baktuns must be greater than or equal to 0.");
}
if(kat < 0 || kat > 19)
{
throw new IllegalArgumentException("Katuns must be a number 0-19 inclusive.");
}
if(tun < 0 || tun > 19)
{
... |
60619704-4664-4b04-806b-145a3ad8c7cc | 5 | private void toNote() {
ItemDefinition noteTemplateDefinition = getDefinition(noteTemplateId);
modelId = noteTemplateDefinition.modelId;
modelZoom = noteTemplateDefinition.modelZoom;
modelRotationX = noteTemplateDefinition.modelRotationX;
modelRotationY = noteTemplateDefinition.modelRotationY;
modelRotatio... |
4cc3905c-882e-452a-9e15-acd0c7e84488 | 4 | public static double getDistance(ClusterPoint p1, ClusterPoint p2, int distanceType)
{
double sum = 0.0;
switch(distanceType)
{
case MANHATTEN:
for(int i = 0; i < p1.getDimensionSize(); i++)
sum += Math.abs(p2.getValueAtDimension(i) - p1.getValueAtDimension(i));
return sum;
case EUC... |
958d5c24-7bc3-4a4b-ab9b-96cbfc2dbeb2 | 1 | public final void run() throws FatalError {
printJump("(" + count + ")");
// cut it into parts to safe session
int c = count;
while (c > 10) {
// sleep for 10 min
Control.sleep(6000, 2);
c -= 10;
Control.current.getCharacter();
}
Control.sleep(600 * c, 2);
} |
9b453e4d-3dcb-4704-a2ae-347974dcb1c9 | 7 | public Object nextValue() throws JSONException {
char c = nextClean();
String string;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
139c81d4-d7de-4d8a-9130-ae8afa52c576 | 5 | public final TLParser.assignment_return assignment() throws RecognitionException {
TLParser.assignment_return retval = new TLParser.assignment_return();
retval.start = input.LT(1);
Object root_0 = null;
Token Identifier15=null;
Token char_literal17=null;
TLParser.indexe... |
9aa760b6-9f80-487b-8cd8-62da5376c5fa | 9 | public boolean skipPast(String to) throws JSONException {
boolean b;
char c;
int i;
int j;
int offset = 0;
int length = to.length();
char[] circle = new char[length];
/*
* First fill the circle buffer with as many characters as are in the
... |
9c8111df-0c88-48c2-bd5a-52b3397f15c4 | 2 | public void printScreen(byte[] screen, int width){
int bytesPerLine = width/8;
int height = screen.length / bytesPerLine;
for(int i = 0; i < height; i++){
//print each line;
int startByteIndex = i*bytesPerLine;
int endByteIndex = startByteIndex + bytesPerLine-1;
for(int j = startByteIndex; j<=endBy... |
b6bb026c-0022-41f7-8c1b-de90ae7f2871 | 2 | private Thread searchThreadsInSubGroup(final String threadName, final ThreadGroup group, final int level) {
ThreadGroup[] groups = new ThreadGroup[group.activeGroupCount() * 2];
int numGroups = group.enumerate(groups, false);
Thread thread = null;
for (int i = 0; i < numGroups && thread == null; i++) {
thre... |
bc24f2e2-4c64-43c5-ad73-0b5648081d58 | 6 | public static int uniquePaths(int m, int n) {
int[][] path = new int[m][n];
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
if (0 == i && 0 == j) path[i][j] = 1;
else if (0 == i) path[i][j] = path[0][j - 1];
else if (0 == j) path[i][j] = path[i - 1][0];
else path[... |
84b8fb97-3a27-4ccd-8626-02b2db054c9b | 1 | public static S3Bucket[] listAllBuckets(RestS3Service s){
S3Bucket[] s3buckets= null;
try {
s3buckets = s.listAllBuckets();
} catch (S3ServiceException e) {
e.printStackTrace();
}
return s3buckets;
} |
10b04d7e-fa2c-4ba9-8bde-8a4c3ad36ce2 | 9 | private void makeFlushStates() {
for (int cn0 = 0; cn0 < RANK_SIZE; cn0++) {
for (int cn1 = cn0 + 1; cn1 < RANK_SIZE; cn1++) {
for (int cn2 = cn1 + 1; cn2 < RANK_SIZE; cn2++) {
for (int cn3 = cn2 + 1; cn3 < RANK_SIZE; cn3++) {
for (int cn4 = cn3 + 1; cn4 < RANK_SIZE; cn4++) {... |
96796965-0ba4-4fb5-bb62-fc306d48d4b2 | 7 | public String[] mapTypes(String[] types) {
String[] newTypes = null;
boolean needMapping = false;
for (int i = 0; i < types.length; i++) {
String type = types[i];
String newType = map(type);
if (newType != null && newTypes == null) {
newTypes = new String[types.length];
if (i > 0) {
System.a... |
3abb639a-3bcd-4f1a-9c58-8c3c22d282ff | 6 | @Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String del = (String) req.getParameter("del");
if(del != null && del.equals("yes")){
log.info("remove file");
MatchUtil.removeFile();
}
String time = (Strin... |
3c6870b2-5c7a-4263-99e9-7c691d0b3586 | 3 | public void settle(){
int buyquant = Integer.parseInt(buynumber.getText());
int sellquant = Integer.parseInt(sellnumber.getText());
int type_int = type.getSelectedIndex()+1;
int current = sector.getQuantity(type_int);
int checkCap = Empous.Gov.getStat("reserve") - sum[0][0];
int checkWood = Empous.Gov.ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.