method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
18cf5f97-3c43-46e4-aed9-cbba38794e41 | 9 | public void setData(DistrictMap dm) {
dm.calcSeatsVotesCurve();
double d = dm.calcSeatsVoteAsymmetry();
seats_votes = dm.seats_votes;
if( seats_votes.size() ==0) {
return;
}
double min = 1;
double median = 0.5;
double below_x = 0;
double above_x = 0;
double below_y = 0;
double above_y = 0;
... |
0ab1260d-730b-4298-a1f0-eb5c49a491af | 0 | public boolean add(String threeCharCode) throws UnsupportedEncodingException {
// TODO: also accept two character codes, full names of languages, etc
return super.add(new Locale(LocaleSet.iso639_2_to_iso639_1(threeCharCode)));
} |
4bbfb2c9-3a62-4c22-97c0-cfd942997072 | 9 | public static String checksum( String fileLocation , int algorithm )
{
String alg = null;
switch ( algorithm ) {
case Constants.CHECKSUM_ALG_MD_2: alg = "MD-2"; break;
case Constants.CHECKSUM_ALG_MD_5: alg = "MD-5"; break;
case Constants.CHECKSUM_ALG_SHA_1: alg... |
87674b49-d5f7-49b6-a3d0-6bf67db0d2cc | 4 | public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
Class<T> rawType = (Class<T>) type.getRawType();
if (!rawType.isEnum()) {
return null;
}
final Map<String, T> stringToConstant = new HashMap<String, T>();
for (T constant : rawType.getEnumConstants()) {
stringToConstant.put(constan... |
6ec9d7d6-4532-4dc9-ac5e-2a5708727bc8 | 9 | public void create(FenomenosClimaticos fenomenosClimaticos) throws PreexistingEntityException, Exception {
if (fenomenosClimaticos.getHistoricoPrecioList() == null) {
fenomenosClimaticos.setHistoricoPrecioList(new ArrayList<HistoricoPrecio>());
}
EntityManager em = null;
try ... |
135d5e09-7ac9-4a27-9907-c8751dbaecf2 | 1 | public static void main(String args[]){
int[] input={1,3};
C1Dot1 c=new C1Dot1();
// for(int k=0;k<c.findOddPair(input).length;k++){
// System.out.println(c.findOddPair(input)[k]);
// }
// if(c.findOddPair(input)>0){
// System.out.println("There is at least one pair of odd products");
// }els... |
63c47dfa-f584-44bb-95e6-bb6d951364ae | 4 | public Field getField(int x, int y) {
if ( x >= 0 && x < size && y >= 0 && y < size) {
return board[x][y];
}
return null;
} |
e5c7527d-ed6b-496f-860a-38105e5ea9cc | 6 | private void initItems() {
items = new ArrayList<>();
BufferedImage image = getItemImage();
itemImage = image;
List<Integer> xPos = new ArrayList<>();
List<Integer> yPos = new ArrayList<>();
for (int x = 2; x < level.getWidth() - 2; x++) {
boolean wasLastAir = false;
for (int y = 0; y < level.getHeigh... |
2aa85f43-280c-46b2-8b61-f8c7dcea6cc5 | 3 | public static Preload parse(HtmlElement element, String str){
switch(str){
case "metadata":
return METADATA;
case "none":
return NONE;
case "auto":
default:
return AUTO;
}
} |
d7cffa6c-8114-4c07-8f7a-7f2377a5403f | 3 | public static Tabelle getTabelle(String name) {
if (name == null) return null;
if (name.equalsIgnoreCase("labordaten")) {
return Tabelle.LABORDATEN;
} else if (name.equalsIgnoreCase("massendaten")) {
return Tabelle.MASSENDATEN;
}
return null;
} |
e84e6487-7235-4b09-ba2e-71c67ce87997 | 1 | private static IClient getClient(String artistName) {
if(FileUtil.checkEventFileExists(artistName)) {
return new FileClient();
} else {
return new HttpClient();
}
} |
f0c76d01-1e02-42e3-a13b-cbd857f4dc3b | 0 | public static String getFileSeparator() {
return System.getProperty(Constants.FILE_SEPARATOR.toString());
} |
91b0bd15-2632-43fa-8995-a8fc6025edb1 | 4 | public static void main(String[] args) throws IOException
{
br = new BufferedReader(new InputStreamReader(System.in));
sn = new Scanner(System.in);
String z;
while((z = br.readLine()) != null)
{
a.clear();
String[] c = z.split("\\s");
int n = Integer.parseInt(c[0]);
int m = Integer.parseInt(c[... |
05157447-70c7-4df1-8140-9ea6eeca9e7c | 5 | private void pintarImgBinariaRGB(short matrizR[][],short matrizG[][],short matrizB[][]) {
System.out.println("Pinta Imagen Binaria");
Graphics g;
Color color;
int centroJ = (114/2);
int centroI = (123/2);
imagen = createImage(getWidth(), getHeight());
g = imagen.g... |
e11d7b67-455f-4a87-b72e-4f435fef89ed | 6 | @Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON... |
9974616d-bceb-4c1e-8a5a-cdf3a44e1c35 | 2 | boolean isWhite() {
return R == 1 && G == 1 && B == 1;
} |
7ced5aa7-b3a3-47ba-9341-191464e891d0 | 3 | private void drawLasers(Graphics2D g, TileMap map, int offsetX, int offsetY){
// draw lasers
Iterator l = map.getLasers();
while(l.hasNext()){
Laser laser = (Laser)l.next();
Line2D line = laser.getLine();
int x1 = (int)Math.round(line.getX1())+offsetX;
... |
9f63d0dc-e16e-4fa2-9812-5cab672ebb5a | 1 | @Override
public boolean canDeleteSelection() {
return mDeletableProxy != null ? mDeletableProxy.canDeleteSelection() : false;
} |
6d68961e-7466-46e1-9ad8-92a70fa99582 | 6 | public boolean allMosquitoesCaptured(int[][] board) {
boolean captured = true;
for ( int i = 0; i < 100; i++ ) {
for ( int j = 0; j < 100; j++ ) {
if ( board[i][j] > 0 ) {
boolean capturedByLight = false;
for ( Light light : lights ) {
double x = Math.pow(i-light.getX(),2);
double y = ... |
f6fe3e3b-f21f-4f1a-ba47-8370609e3de7 | 5 | private boolean excludingFile(String line) {
if (line == null) {
return false;
}
for (int i = 0; i < this.getFileIgnores().length; i++) {
String matcher = this.getFileIgnores()[i];
if (matcher != null && matcher.length() > 0 && line.startsWith(matcher)) {
return true;
}
}... |
beff39b4-4b0b-40e3-a9f9-28c5f26708fc | 8 | static void battroad_draw_background(osd_bitmap bitmap, int prioritylayer)
{
int offs;
for (offs = videoram_size[0]-2;offs >= 0;offs -= 2)
{
if ((dirtybuffer[offs]!=0 || dirtybuffer[offs+1]!=0) && !(prioritylayer==0 && (videoram.read(offs+1) & 0x04)!=0))
{
int sx,sy;
dirtybuffer[offs] = 0;
... |
d7b0a99f-da57-408e-9af8-91b433d5fcc1 | 4 | public void remove(int offs, int len) throws BadLocationException {
// return immediately when selecting an item
if (selecting)
return;
if (hitBackspace) {
// user hit backspace => move the selection backwards
// old item keeps being selected
if (offs > 0) {
if (hitBackspaceOnSelection)
offs-... |
370f8bb5-f5b9-417f-98bc-62390304d94a | 2 | @RequestMapping(value = {"/EntidadBancaria/{idEntidadBancaria}"}, method = RequestMethod.DELETE)
public void delete(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @PathVariable("idEntidadBancaria") int idEntidadBancaria) {
try {
entidadBancariaDAO.delete(idEntidadBancar... |
5cbe2ca4-fff3-41ff-89a4-1a82208fff44 | 6 | public void wdgmsg(Widget sender, String msg, Object... args) {
if (sender == obtn) {
if (msg == "activate")
wdgmsg("make", 0);
return;
}
if (sender == cbtn) {
if (msg == "activate")
wdgmsg("make", 1);
return;
... |
3133c4ab-aa97-4ee8-87b2-4dcf6b318c26 | 1 | @Override
public void paint(Graphics gg) {
Graphics2D g = (Graphics2D) gg;
g.setBackground(Color.DARK_GRAY);
g.clearRect(0, 0, getWidth(), getHeight());
for (DrawableParticle p : m.pDraw) {
p.draw(g);
}
} |
7b1cff42-2d0e-4f9a-8c90-a5dfce5090af | 0 | public void setPropertyInherited(boolean propInherited) {this.propInherited = propInherited;} |
3f2fc2c5-e778-4183-b3a2-9c0d3fff69e2 | 0 | public void put(Object o) {
size++;
super.put(o);
} |
28b3cff1-d848-4511-a112-c2c48777e9f2 | 0 | public void setFirstPlayer(String s)
{
firstPlayer = s;
} |
1a618ad7-c793-456c-9358-6360c4254730 | 2 | private Boolean checkData(String litra){
/*
* elegxei an einai swsti i timi kai an oxi tote emfanizei minima lathous
*/
if(litra.length()<1){
JOptionPane.showMessageDialog(null, "Den Dwsate arithmo litrwn");
return false;
}
try{
double d = Double.parseDouble(litra);
}catch(NumberFormatException nf... |
03c1d912-cea7-4685-9463-2fb1c715eaca | 6 | public void connect(TreeLinkNode root) {
if (root == null) {
return;
}
LinkedList<TreeLinkNode> queue = new LinkedList<TreeLinkNode>();
queue.add(root);
while (!queue.isEmpty()) {
int size = queue.size();
for (int i = 0; i < size; i++) {
... |
48f9312b-930b-4f4d-a934-156b0e177dd9 | 0 | @Override
public void setAttemptClientConnect(IAttemptClientConnect attemptClientConnect) {
this.attemptClientConnect = attemptClientConnect;
} |
95a5a3ab-c2f6-4c27-bb21-9977b31e2cb4 | 9 | private static String formatString(String orginal, String delimiter) {
if (orginal.length() > 1) {
String[] temp = orginal.split(delimiter);
StringBuffer sb = new StringBuffer();
for (String cat : temp) {
if (cat.length() > 1) {
String formated = null;
if (cat.contains("@")) {
formated = ... |
c937d053-3f93-4f15-9b17-7d794f5c8624 | 5 | public MyList findOneTileMoves(String player) {
// Check if player is valid (so we don't have to worry about
// null pointers later).
if (player == null || ! (player.equals("red") ||
player.equals("blue")))
return null;
MyList moves = new MyList();
// Iterat... |
4124e075-e795-4b55-83af-44ea17b575ae | 0 | public Human(String name) {
this.name = name;
} |
6e8e871a-fcb3-4ffc-b5d0-d53e241ae47c | 9 | public String TranscribeAString(String textToTranscribe) throws Exception
{
//Declaration of the resulting transcription.
String resultingTranscription="";
//Declaration of the source text index iterator.
int positionInTheString = 0;
//Indicator, whether a rule suitable in a position was found or not.
bool... |
5fcbaecd-5ce3-45c9-b318-a5dd2ef6351f | 0 | public FlacMetadataBlock(Property prop, PropertyTree parent) {
super(prop, parent);
} |
016330ee-51f3-4970-88ed-ac4cf0801111 | 5 | public void registerMethods(Class<?> clazz){
Method [] methods = clazz.getMethods();
for(Method c : methods){
if(Modifier.isStatic(c.getModifiers())){
if(c.isAnnotationPresent(MazeGenerator.class)){
mazeGenerators.add(c);
}else if(c.isAnnot... |
4c7c15e4-e9b4-45ea-a4e4-28c228274aeb | 3 | public static void enableFullScreenMode(Window window) {
String className = "com.apple.eawt.FullScreenUtilities";
String methodName = "setWindowCanFullScreen";
try {
Class<?> clazz = Class.forName(className);
Method method = clazz.getMethod(methodName, new Class<?>[] { Window.class, boolean.class });
me... |
b1fb4c12-38f2-437b-8100-d9073e905353 | 1 | public static void main( String[] args )
{
int loopLimit = 100;
for ( int count = 0; count < loopLimit; count++ )
{
System.out.println( count );
}
} |
7662a1bb-7aff-42e0-8260-54f739230a26 | 2 | public static void fixPPBug()
{
System.out.println("Power Point Bug Fixed");
for(int i=0; i<4; i++)
{
//if(enemy[enemyIndex].move[enemyCmd]==user[userIndex].move[i]&&user[userIndex].move[i].pp<user[userIndex].move[i].ppMax)
//user[userIndex].move[i].pp++;
user[userIndex].move[i].pp=user[userIndex].TR... |
edbe1c7e-8797-41ea-b089-e36924d9b329 | 5 | public void targetLocation() {
PhysicsComponent ownPC = (PhysicsComponent)getOwningActor().getComponent("PhysicsComponent");
WeaponsComponent wc = (WeaponsComponent)getOwningActor().getComponent("WeaponsComponent");
if(ownPC != null && withinRadius(Math.abs(ownPC.getX() - attackTargetX)... |
d6411136-5b91-43e3-a431-94e133b7e0f2 | 8 | public static void main(String[] args) {
Scanner inputScanner = null;
try {
inputScanner = new Scanner(new File(args[0]));
}
catch (Exception e) {
System.err.println("Invalid file input");
}
while (inputScanner.hasNextLine()) {
String input = inputScanner.nextLine();
String[][] set = new String[... |
89ceff3d-cf6b-406c-8760-b57ca24f0431 | 8 | public List<Mass> findReachableMassesAndInputs(Mass mass, Range range, boolean excludeCrossings) {
List<Mass> massesInRange = new LinkedList<>();
for (Mass candidate : masses) {
if (mass == candidate) {
continue;
}
if (candidate.getType() != NETWORK ... |
75c4d563-4ff3-4d23-87f6-2bef2669461b | 6 | public boolean checksolidBelow(int xa, int ya) {
boolean solid = false;
for(int i = 0; i < 4; i++) {
int xp = ((x + xa) + i % 2 * 12 - 7) / engine.getScreenEngine2D().PixelWidth;
int yp = ((y + ya) + i / 2 * 12 + 7) / engine.getScreenEngine2D().PixelHeight;
if (level.colltype.equals(CollisionType.BAS... |
d3db0811-e754-45e9-9050-5ec74597861e | 1 | private void notifyListeners()
{
for (NamesListener listener : listeners)
listener.onNamesChanged(leftName, rightName);
} |
b94c313c-b78b-4758-a27d-acc468999e26 | 1 | public void tick()
{
switch(Screen)
{
case "inGame":
inGameManager.tick();
break;
}
} |
6c233d29-029c-4977-8648-b5b230c5bb3b | 1 | public static Filter inPackage( String targetPackage )
{
if ( targetPackage == null )
{
throw new IllegalArgumentException( "Parameter 'targetPackage' must be not null" );
}
return new InPackage( targetPackage );
} |
2ad20e3f-9905-4489-aebf-f1c5544e2718 | 9 | public static Piece getPiece(int numMines) {
switch (numMines) {
case 0: return zero;
case 1: return one;
case 2: return two;
case 3: return three;
case 4: return four;
case 5: return five;
case 6: return six;
case 7: return seven;
case 8: return eight;
default: return null;
}
} |
74271120-aede-4429-b426-79e674dbae17 | 6 | static Cons sequenceToConsList(Stella_Object sequence) {
{ Surrogate testValue000 = Stella_Object.safePrimaryType(sequence);
if (testValue000 == Logic.SGT_STELLA_CONS) {
{ Cons sequence000 = ((Cons)(sequence));
return (sequence000);
}
}
else if (Surrogate.subtypeOfP(tes... |
01d1f3a7-ff78-4dea-b058-16d671f260bf | 4 | protected KeyboardBuffer() {
//Mouse Initialization code
try {
if(!Mouse.isCreated()) { //Check to see if the LWJGL mouse has been created
Mouse.create();
}
} catch(LWJGLException e) {
System.out.println("Unable to initialize the Mouse!");
}
//Keyboard Initialization code
try {
if(!Keyboa... |
a7d0ef68-14e6-4257-b9f7-7733c3ebb084 | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (; ; ) {
c = next();
... |
d579d501-8a13-4055-a75e-22b03771ee75 | 1 | public List findAll() {
log.debug("finding all Record instances");
try {
String queryString = "from Record";
Query queryObject = getSession().createQuery(queryString);
return queryObject.list();
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
} |
c64e8bd3-554a-41b4-b0aa-7c1c7f7089b2 | 3 | public void closeBraceContinue() {
if ((Options.outputStyle & Options.BRACE_AT_EOL) != 0)
print("} ");
else {
println("}");
if ((Options.outputStyle & Options.BRACE_FLUSH_LEFT) == 0
&& currentIndent > 0)
untab();
}
} |
8f48a336-562a-4dbb-a424-0422983bdfbd | 0 | public TBItemListFetcher(RequestWrapper requestWrapper) {
super(requestWrapper);
} |
140574cd-4caa-4650-9c03-096e27edc413 | 2 | private void code_data_content() {
String mySub;
for (int i = 0; i < mydata_str.length(); i++) {
mySub = mydata_str.substring(i, i + 1);
mySub = getChar_code(mySub);
if (mydata_coded == null) {
mydata_coded = mySub;
} else {
... |
957e2ad8-19d4-4da6-97c2-c3ff7991ed2d | 6 | public Component getListComponentForDataSection(TaskObserver taskObserver, String dataSectionName, List list, Iterator indexIterator) throws InterruptedException
{
List indexNumberList = listForIterator(indexIterator);
Integer indexNumber = (Integer)indexNumberList.get(0);
int index = indexN... |
63f08b44-eaa1-4308-a1d2-2cc01474f850 | 6 | public void clearReferences() {
if (!referencesCleared) {
if (account != null)
account.removeReference();
if (transferAccount != null)
transferAccount.removeReference();
if (category != null)
category.removeReference();
... |
21745ada-1f7c-496a-a09f-3d7db09dfe70 | 9 | private static void addBridgeMethod(ClassFile cf,
MethodEntry mainMethod,
MethodEntry bridgeMethod) {
Method method = bridgeMethod.getMethod();
// Don't override any methods in Object, especially final ones.
if (is... |
0367645c-fffa-4c73-a0c0-160ea535afb7 | 5 | private void compileFile(ArrayList<byte[]> filePortions){
int fileLength = 0;
for(byte[] buff : filePortions){
fileLength += (Packet.getDataLength(buff));
}
completeFileBuffer = new byte[fileLength];
int fileFilled = 0;
for(byte[] buff : filePortions){
for(int i = 20; i < Packet.getDataLength... |
bfa0dc1c-3030-4eb2-ad32-47703819b207 | 8 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Hashtags that = (Hashtags) o;
if (idHashtag != that.idHashtag) return false;
if (description != null ? !description.equals(that.description) : ... |
e2cbbd03-eec6-4966-a306-39fd00f3e59e | 9 | public static String addPizza(HttpServletRequest req) {
HttpSession s = req.getSession();
UserBean user = (UserBean) s.getAttribute("user");
String username = user.getUsername();
try {
if (Model.getUtente(username).getPermission().equals("admin")) {
String nom... |
c657e79f-29ee-4804-bcd0-efd507431d68 | 3 | static public ByteArrayInputStream encodeFile(String src)
{
byte[] fileBytes;
ByteArrayInputStream bis = null;
try {
fileBytes = read(new File(src));
for(int n=0;n<fileBytes.length;n++)
{
fileBytes[n]-=key;//config.xmlcoded
}
bis = new ByteArrayInputStream(fileBytes);
} catch (FileNotFoundEx... |
0f6fe188-73a1-43a9-96ca-967d5f24e197 | 1 | public void testIsBefore_LocalDate() {
LocalDate test1 = new LocalDate(2005, 6, 2);
LocalDate test1a = new LocalDate(2005, 6, 2);
assertEquals(false, test1.isBefore(test1a));
assertEquals(false, test1a.isBefore(test1));
assertEquals(false, test1.isBefore(test1));
assertEq... |
ab49dbc7-5956-4b0d-9cc1-ef62a2158481 | 8 | public boolean equals( Object other ) {
if ( ! ( other instanceof TObjectLongMap ) ) {
return false;
}
TObjectLongMap that = ( TObjectLongMap ) other;
if ( that.size() != this.size() ) {
return false;
}
try {
TObjectLongIterator iter = ... |
44dce222-9b4f-4caa-a0a0-97e466dbcf9d | 1 | public void closeZip()
{
try {
output.close();
} catch (IOException ex) {
Logger.getLogger(ZipPacker.class.getName()).log(Level.SEVERE, null, ex);
}
} |
beec0d34-2368-4585-a09a-f1f2db42560a | 4 | @EventHandler
public void onCrazyFireMove(PlayerMoveEvent pME) {
Player player = pME.getPlayer();
if(CrazyFeet.CrazyFire.contains(player)) {
Location to = pME.getTo();
Location from = pME.getFrom();
Location loc = player.getLocation();
if(to.getX() != from.getBlockX() || to.getY() != from... |
e7808b12-fad1-4370-8ab7-ae70d79caf8d | 8 | public static void main(String[] args) throws Throwable{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));int caso=1;
StringBuilder sb=new StringBuilder();
for(StringTokenizer st;(st=new StringTokenizer(in.readLine()))!=null;){
int N=parseInt(st.nextToken()),C=parseInt(st.nextToken());
... |
7a333835-5017-4dd1-aa3c-6b8e00a727db | 5 | public static String decrypt(final String encryptedText) {
String decryptedtext = null;
if (encryptedText != null && !("null".equals(encryptedText))) {
TripleDesCipher cipher = new TripleDesCipher();
cipher.setKey("GWT_DES_KEY_16_BYTES".getBytes());
try {
decryptedtext = cipher.decrypt(encryptedT... |
e61d93ae-be69-4c45-af33-3fd28158f16d | 6 | public int match_main(String text, String pattern, int loc)
{
// Check for null inputs.
if(text == null || pattern == null)
{
throw new IllegalArgumentException("Null inputs. (match_main)");
}
loc = Math.max(0, Math.min(loc, text.length()));
if(text.equals(pattern))
{
// Shortcut (potentially not ... |
a9cb23c0-ac64-4166-aef0-89a5a537726f | 0 | public void setMbid(String mbid) {
this.mbid = mbid;
} |
575f4bbb-4654-47a4-bf63-d79c1b5724a8 | 6 | protected int handleInput(Automaton automaton,
AutomatonSimulator simulator, Configuration[] configs,
Object initialInput, List associatedConfigurations) {
JFrame frame = Universe.frameForEnvironment(getEnvironment());
// How many configurations have we had?
int numberGenerated = 0;
// When should the nex... |
03b77e0c-5837-4453-9fab-dc526ec7249b | 6 | @EventHandler
public void SlimePoison(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.getSlimeConfig().getDouble("Slime.Poison.Dodg... |
4b2f46b0-d5b4-4d34-bea1-cea32fe19cf6 | 4 | protected int[] generate_num_k(String plain,int primer)
{
//special case: plain.length<primer.length
int[] result=new int[plain.length()];
String p_s=Integer.toString(primer);
char[] p_array=p_s.toCharArray();
int array_len=p_array.length;
// assert(p_array.length==5);
int init=plain.length()<5?plain.leng... |
af40e694-7a4a-452f-9788-a544f8bf761c | 0 | void putMergeVars(final Map<String, Object> mergeVars) {
this.mergeVars.putAll(mergeVars);
} |
9f9867d0-b035-4917-a8f8-1fdabd360dd1 | 6 | public static void outPutInboundTrainInfo(ArrayList<ArrayList<Block>> bl){
try{
jxl.write.WritableWorkbook writeWorkBook = Workbook.createWorkbook(new File("Output_File.xls"));
jxl.write.WritableSheet writeSheet = writeWorkBook.createSheet("inbound_train", 0); //建立一個工作表名字,然後0表示為第一頁
writeSheet.addCell(new... |
cf7b39c8-35a3-4d97-857e-4545f8d48a27 | 4 | public void liiku(Ruutu seuraava, Robotti robo) {
if (seuraava == null) {
robo.tuhoudu();
} else {
robo.setRuutu(seuraava);
}
if (robo.getRuutu().getRuudussa()!=null) {
if (robo.getRuutu().getRuudussa().tyyppi().equals("kuoppa")) {
robo... |
7d7e5e20-befa-40d2-8c4b-7f2b978f28cf | 3 | public String getProperty(String key, boolean mandatory) throws DAOConfigurationException {
String fullKey = specificKey + "." + key;
String property = PROPERTIES.getProperty(fullKey).toString();
if (property == null || property.trim().length() == 0) {
if (mandatory) {
... |
4109b297-39bd-4960-9ae0-64e53921451e | 9 | public List<Product> viewAllProducts(int group, int offset, int recordsOnPage,
Sorting sorting, SortingType sortingType) {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("SELECT SQL_CALC_FOUND_ROWS * FROM product ");
if (group > 0) {
queryBuilder.append("where group_id... |
60481913-e367-43b2-813f-6fd25ab72ea3 | 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... |
35da46d9-057b-4580-b5bd-e9282b6b0ac6 | 3 | @Override
public void repaint(TextGraphics graphics)
{
border.drawBorder(graphics, new TerminalSize(graphics.getWidth(), graphics.getHeight()), title);
TerminalPosition contentPaneTopLeft = border.getInnerAreaLocation(graphics.getWidth(), graphics.getHeight());
TerminalSize contentPaneSi... |
1769d3dd-8d39-45da-b864-28362fb4c44b | 7 | @Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case statePackage.PLAYER__OWNED_COUNTRIES:
return ownedCountries != null && !ownedCountries.isEmpty();
case statePackage.PLAYER__OWNED_CARDS:
return ownedCards != null && !ownedCards.isEmpty();
case statePackage.PLAYER__NAME:
... |
561a7760-a388-4f51-8509-b482b601091a | 7 | public static SequenceMove fast(int num, int withMove) {
EflUtil.assertNoEfl();
List<Move> moves = new ArrayList<Move>();
int move = num > 0 ? Move.DOWN: Move.UP;
if (num < 0)
num = -num;
if(num > 0)
moves.add(new PressButton(move | (num == 1 ? withMove : 0)));
for (int i=1; i<num; i++)
moves.ad... |
54efc338-4708-4e9c-8c04-c9ba195509c8 | 2 | public void onEnable() {
// Immediately provide an offline mode warning, due to how incredibly dangerous it is in the case of this plugin.
if (!getProxy().getConfig().isOnlineMode()) {
getLogger().warning("IMPORTANT! BungeeCord is running offline mode, meaning hackers and cracked accounts ca... |
327fb1fe-5117-4424-87db-89deee7f4484 | 8 | public static void registerEntities() {
for (RideAbleEntityType entity : values())
a(entity.getCustomClass(), entity.getName(), entity.getID());
// BiomeBase#biomes became private. But we can use the public method getBiomes() to get the array
for (BiomeBase biomeBase : BiomeBase.getBiomes()){
if (biomeBase... |
774ae365-5bfc-452a-b694-1a6b67f8792f | 6 | private void setDetails( VgerItemData theItem )
{
if ( theItem.getItemEnum() != null &&
theItem.getItemEnum().length() != 0 &&
!theItem.getItemEnum().equals( "" ) )
{
String boxNumber;
String seriesID;
Matcher boxMatcher;
Matcher seriesMatcher;
Pattern boxPatte... |
c4169da0-8d4e-4c10-9c50-20085cb61b17 | 5 | private Cor setRandomColor(){
if(Range.getPercentual() > 60){
switch (new Range(1,4).getRandom()) {
case 1: return Cor.AMARELA;
case 2: return Cor.AZUL;
case 3: return Cor.VERDE;
case 4: return Cor.VERMELHA;
}
}
return Cor.MARROM;
} |
4bdb9b10-ae55-4ac9-8b9a-2ba01554eb25 | 1 | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainFrame frame = new MainFrame();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
} |
b4dd56ac-2543-4c9b-ab09-ee6a9ceacd88 | 1 | public double calcPathWeight(Path path) {
double total_weight = 0.0;
Point p;
for (int i = 0; i < path.size(); i++) {
p = path.get(i);
// TODO: check if weighted by weight or source values (probable weighted, right?)
total_weight += _map.getSource(p.x(), p.y());
}
return total_weight;
} |
9694a7d2-d339-471f-94d7-bd2aee7e3367 | 9 | private void spinner_y1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinner_y1StateChanged
if(hitbox_index_selected!=-1 || click_target_flag)
{
click_target_flag=true;
if(hitbox_index_selected!=-1)
{
int i=0;
for(Node hitboxes_node=current_fr... |
8bb01922-a49f-4e59-a470-2e4b17b2c227 | 7 | public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int n = Integer.parseInt(st.nextToken());
int m = Integer.parseInt(st.nextToken());
int[] a... |
57dd6d0f-0116-422d-b3c4-11d0b2d5c53a | 1 | public posiciones() {
modelo = (DefaultTableModel) table1.getModel();
modelo.addColumn("Jugador 1");
modelo.addColumn("Jugador 2");
modelo.addColumn("Score");
set = TennisGame.getInstance();
table1.addMouseListener(new MouseAdapter() {
@Override
pu... |
565949de-0330-40e2-81ad-b1b4e17f6fac | 7 | public static OPERATION getEnum(String nam){
if(nam != null && !nam.isEmpty()){
if(nam.equalsIgnoreCase(AND.name))
return AND;
else if(nam.equalsIgnoreCase(OR.name))
return OR;
else if(nam.equalsIgnoreCase(XOR.name))
return XOR;
else if(nam.equalsIgnoreCase(FLIP.name))
return FLIP... |
8f49489f-9606-4ef9-95c0-1119a95d1531 | 5 | public static Double[][] fillArrayFromFile(String file) {
Double[][] array = null;
try {
// Open the file that is the first
// command line parameter
FileInputStream fstream = new FileInputStream(file);
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
Buffere... |
e35f3ce6-0106-4564-9830-5ebcb169bb31 | 2 | public SensorList(ArrayList<Sensor> sensor) {
super();
JBackgroundedPanel bp = new JBackgroundedPanel("resources/Menu.png");
bp.setLayout(null);
this.setModal(true);
this.setBounds(deviceWidth/2 - width/2, deviceHeight/2 - height/2, width, height);
button = new JButton("Back");
button.setBounds(8... |
b3b2f22d-2a4f-4336-81fe-4e76d4cd3c46 | 9 | private void txtCodigoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodigoActionPerformed
// TODO add your handling code here:
//Tomo el texto y determino el tamaño
String codigo = txtCodigo.getText();
Date date = new Date();
String FecActual = Formateador... |
9e202a02-8029-412c-9f41-915437d15666 | 5 | public static void main(String[] args) {
//Define variable to keep track of number of ways to get 9 and 10
int totalNine = 0;
int totalTen = 0;
//define loops to get every possible way the dice could land.
for (int Die1 = 1; Die1 <= 6; Die1++) {
for (int Die2 = 1; Die2 <= 6; Die2++) {
for (int Die3 =... |
91b4b07f-8854-4518-aaef-321a65ca43ba | 2 | private void checkFile(String path) {
if(path.indexOf(getOsFileSeparator()) == -1){
System.out.println("디렉토리 구분자가 잘못되었습니다."); //리소스 경로 잠못된것인지 체크
}
File file = new File(path);
if(!file.exists()){//디렉토리일때만 경로를 확인, 쓰기에서 때문에.
System.out.println("지정한 파일(경로)가 존재하지 않습니다."); //리소스 경로에 리소스가 있는지 체크
/... |
d972acb6-5e6d-4bbe-b85a-e45a8c6fde9b | 0 | public void setGrid(GrilleTetris grid) {
this.grid = grid;
} |
8fd03ebf-3457-4968-9f81-e52fb2d07ba8 | 7 | private static void updateItems(ArrayList<InventoryPackages> packagesDB){
Scanner updateItemScanner = new Scanner(System.in);
System.out.println("---------------------------------------------------------------------------------------------------------------------------------------------");
System.out.println(... |
c86cddb3-dc02-4f33-9a6d-e3e40c0ef79b | 5 | static int findFactorByFLimit(final double value)
{
int from = 0;
int to = FLIMITS.length - 1;
if (value < FLIMITS[to])
{
return to;
}
do
{
final int mid = (from + to) >> 1;
if (FLIMITS[mid] >= value)
{
if (FLIMITS[mid + 1] < value)
{
return mid;
}
else
{
from = mid;
}
}
e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.