method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d35ada3f-aa5b-4f5d-bf5d-faf16232196c | 0 | public int getLine() {return this.line;} |
fafb4f8d-6511-461d-a9d6-b9f44a92b385 | 1 | public MyList listToList(MapFilter mf) {
MyList newlist = new MyList();
Iterator it = iterator();
while(it.hasNext()) {
newlist.add(mf.map(it.next()));
}
return newlist;
} |
41175fb8-65aa-4786-a920-c456bb3ed7ef | 5 | protected static HDRExposure getExposure( HDRExposure oldExposure, int w, int h, boolean clear ) {
if( oldExposure != null && oldExposure.width == w && oldExposure.height == h ) {
// Can re-use the object!
if( clear ) oldExposure.clear();
return oldExposure;
} else if( clear ) {
// Then just make a new ... |
40a15853-9ecc-4536-8ded-e70693a5a622 | 7 | private static double getPValue( String tissue, int axisNum ) throws Exception
{
BufferedReader reader = new BufferedReader(new FileReader(new File(
ConfigReader.getSaccharineRatDir() + File.separator
+ "mergedUnweightedUnifrac.txt")));
//+ "mergedMapBrayCurtisPCOA.txt" )));
HashMap<String, List<Doub... |
9bec8903-0a03-4e00-908e-324c36b3b8c9 | 4 | private void loadProjektledare() {
ArrayList<Anstalld> al = new ArrayList<>();
ArrayList<String> altemp = new ArrayList<>();
try {
String query = "select aid from anstalld where aid in (select aid from projektledare)";
altemp = DB.fetchColumn(query);
} catch (InfE... |
c5a74689-137e-4d87-83e5-701cd836958a | 1 | @Override
public void draw() {
if(splashImages.peek() != null) {
splashImages.peek().draw();
}
} |
54767d20-0fa8-4143-ae0e-5fbb170056fe | 5 | public void checkRomanNr(String romanNumber) {
int[] substractOperations = new int[8];
char currentLetter = romanNumber.charAt(0);
char nextLeter = romanNumber.charAt(1);
int globalMax;
if (getValue(currentLetter) < getValue(nextLeter)) {
globalMax = getValue(nextLe... |
c3c2c7d5-df6d-4b7f-afca-f428413df7a7 | 2 | public void doGet(HttpServletRequest request, HttpServletResponse response) {
try {
List<String> cats = CommunityDAO.get().getCategories();
PrintStream out = new PrintStream(response.getOutputStream());
out.println("<categories>");
for( String category : cats ) {
out.println("<category name=\"" + cat... |
079f9f09-7416-449f-952d-a8d018195660 | 2 | public void clip(CPRect rect) {
if (isEmpty()) {
return;
}
if (rect.isEmpty()) {
makeEmpty();
} else {
left = Math.max(left, rect.left);
top = Math.max(top, rect.top);
right = Math.min(right, rect.right);
bottom = Math.min(bottom, rect.bottom);
}
} |
f542d6fb-30ad-4d45-8893-0101d6efb7e1 | 2 | public void loadImage(String name) {
if (IMAGE_URLS.containsKey(name) != true) {
LOG.setSubSection("Error");
LOG.log("Image not stored as a URL. Cannot load. \"" + name + "\"");
LOG.useSubSection(false);
return;
}
try {
CURRENT_URL = CL.getResource(IMAGE_URLS.get(name));
ImageIcon ... |
ab0c1789-7923-442c-bb99-31939c234486 | 6 | public static void writeFileTxt(String fileName, String[] totalFile){
FileWriter file = null;
PrintWriter pw = null;
try
{
file = new FileWriter(System.getProperty("user.dir")+"/"+fileName);
pw = new PrintWriter(file);
for (int i = 0; i < totalFile.length; i++)
... |
a228c174-56f5-475a-af47-6279363052e8 | 1 | protected void addDocumentStart() {
try {
h.startDocument();
} catch (SAXException ex) {
throw new RuntimeException(ex.getException());
}
} |
a452f620-482a-4815-b9f5-c912b5ca8d1e | 6 | private int method42(int i, int j, int k)
{
int l = k >> 7;
int i1 = j >> 7;
if(l < 0 || i1 < 0 || l > 103 || i1 > 103)
return 0;
int j1 = i;
if(j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2)
j1++;
int k1 = k & 0x7f;
int l1 = j & 0x7f;
int i2 = intGroundArray[j1][l][i1] * (128 - k1) + intGroundA... |
0f3ec408-6482-47df-9229-d731eda6efba | 6 | public static boolean hasSubsetWithSum0(final int[] numbers) {
double max = Math.pow(2, numbers.length);
Stack<Integer> stack = new Stack<Integer>();
for (int i=0;i<max;i++) {
stack.removeAllElements();
String binary = Integer.toBinaryString(i);
int sum = 0;
boolean ifAdd = false;
for (int j=0;j<bi... |
2fd9b77f-1a36-4649-82ad-07a75c91ecc6 | 2 | public static double[][] addVecToSet(
double[][] vecSet,
double[] addVec )
{
int m = Matrix.getNumOfRows(vecSet);
int n = Matrix.getNumOfColumns(vecSet);
double[][] res = Matrix.newMatrix(m, n);
for ( int i = 0; i < m; ++i )
{
double add = addVec[i];
for ( int j = 0; j < n; ++j )
res[i][j] = vecSet[i][j] ... |
b7756c1d-7aa2-4880-886b-33ab1ae516bc | 2 | public Trie getTrieFromPrefix(String prefix) {
TrieNode curNode = root;
for (char c : prefix.toCharArray()) {
int index = getIndex(c);
if (curNode.children[index] == null) {
return null;
} else {
curNode = curNode.children[index];
}
}
return new Trie(curNode);
} |
4a6a9a91-4cf2-4ccc-8d20-9a3f1b3eb566 | 5 | public void insertEvent() {
PreparedStatement st = null;
ResultSet rs = null;
String q = "INSERT INTO events SET name = ?, location = ?, start_date = ?, end_date = ?";
try {
java.sql.Date sd = null;
java.sql.Date ed = null;
if (this.startDate != null) ... |
9c90e82f-6e63-4415-8376-d6e09f502d14 | 0 | @Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
} |
fffd4d14-f1e1-4b60-b70c-6f101e7d29be | 8 | private static int maxPal(String s, int c)
{
// even
int e = 0, l = c, r = c+1;
if (l < s.length()-2 && s.charAt(l) == s.charAt(r)) {
while (l>=0 && r<s.length() && s.charAt(l--) == s.charAt(r++))
e+=2;
}
// odd
int o = 1;
l = c-1;
r = c+1;
while (l>=0 && r... |
1a1de014-0dad-4743-a552-3e903cc981f8 | 3 | public static ArrayList<bConsultaDef> getConsultaDefMAP(String arg_prod, String arg_data) throws SQLException, ClassNotFoundException {
ResultSet rs;
ArrayList<bConsultaDef> sts = new ArrayList<bConsultaDef>();
Connection conPol = conMgr.getConnection("PD");
if (conPol == null) {
... |
2082abad-51d2-43e2-b46c-0139a7a909ef | 7 | public void run() {
while (running) {
while (!dispatch.isEmpty()) {
DispatchEntity de = dispatch.get(0);
dispatch.remove(0);
if (de.method != null) {
try {
de.method.invoke(de.owner, de.params);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessExcepti... |
8b11e072-4b1e-46b0-b6f1-613df439b10b | 9 | private boolean r_vowel_suffix() {
int v_1;
int v_2;
// (, line 170
// try, line 171
v_1 = limit - cursor;
lab0: do {
// (, line 171
// [, line 172
... |
4e2f68a5-04d0-4ed6-9b6c-e9af8af11c99 | 9 | public void moveForward() {
// as long as I'm on the board
if (onBoard) {
// get the direction of the sprite to find what is foreward;
int dir = image.getDirection();
// now check to see which way to move
switch (dir) {
case (1):
... |
128cb646-dedd-4e67-9929-f3edab9deaa7 | 6 | @Override
public void run() {
try
{
while (true)
{
// Se espera y acepta un nuevo cliente
cliente = socketServidor.accept();
cliente.setSoLinger(true, 10);
VecSocket.add(cliente);
// Se instancia una clase para atender al cliente y se lanza en
// un hilo aparte.
Runnable... |
3e781ec7-3318-4ded-b70a-392a82a7858c | 4 | public boolean isOnPoint(double mx, double my) {
if (state == DeliverState.delivered)
return false;
double x = edge.from.getX() * (1.0 - position) + edge.to.getX() * position;
double y = edge.from.getY() * (1.0 - position) + edge.to.getY() * position;
// Tu sa da nastavovat v... |
4987e044-34ce-4d5d-ab60-97e1f0b181ce | 6 | public String nextCDATA() throws JSONException {
char c;
int i;
StringBuilder sb = new StringBuilder();
for (;;) {
c = next();
if (end()) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i ... |
37dde328-2083-4dc3-94c6-bb2792db1472 | 5 | private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRe... |
76b3db06-9c8f-4c6b-888e-c597d3b23b04 | 8 | protected Map<String, String> getNameNoList(String path) {
if (path == null || path.length() < 1) {
System.out.println("The path to the name-number list file cannot be null.");
return null;
}
Map<String, String> list = new LinkedHashMap<String, String>();
File ... |
0f9e3071-3835-4459-8fb0-acc21e9683cd | 1 | public float getU2() {
if(animation != null) {
return animation.getU2();
}
return tex.getU2();
} |
bd33d73c-2501-4017-b59d-442947e0b504 | 0 | public MessageAdaptor handle(MessageAdaptor message) {
CameraCaptureRequest request = new CameraCaptureRequest();
request.setId(message.getId());
return request;
} |
3c68e9eb-c1e3-44dc-bf38-8db96e1880fc | 3 | private void drawCollectionCreation() {
// Prints name of current Collection
parent.fill(255);
parent.textAlign(PConstants.CENTER);
parent.text(newCollection.getCollectionName(), posX + 438, posY + 117);
// Draws file paths in window
parent.stroke(0);
parent.fill(225);
parent.rect(posX + 35, posY + 15... |
3a72e5ad-bbfc-4b0f-8c64-d9486071f971 | 5 | private boolean isTransitioning(){
if(previousScreen != null && previousScreen instanceof GameScreen){
GameScreen prevGameScreen = (GameScreen) previousScreen;
if(!prevGameScreen.outTransitionFinished()){
//System.out.println("transitioning");
return true;
}
}
if(currentScreen instanceof GameScre... |
e1184172-58bc-4fa5-a2f8-ad2453db3d05 | 6 | String getMenuItemText(String item) {
boolean cascade = item.equals("Cascade");
boolean mnemonic = mnemonicsButton.getSelection();
boolean accelerator = acceleratorsButton.getSelection();
char acceleratorKey = item.charAt(0);
if (mnemonic && accelerator && !cascade) {
return ControlExample.getResourceStrin... |
a9404303-29b1-4a8f-b8f0-e7ebef61da66 | 1 | public void saveAudioVectors(
double[][] newAudioVectors,
String newCollectionName )
{
int n = newAudioVectors.length;
LinkedList<double[]> newAudioList = new LinkedList<double[]>();
audioVectors.add(newAudioList);
DefaultMutableTreeNode newParNd = new DefaultMutableTreeNode(newCollectionName);
dataRootNd.add(ne... |
5b46a445-d891-4d93-9d54-cd983ec27330 | 3 | public boolean containsConflictingLoad(MatchableOperator op) {
if (op.matches(this))
return true;
for (int i = 0; i < subExpressions.length; i++) {
if (subExpressions[i].containsConflictingLoad(op))
return true;
}
return false;
} |
3b7c8cf9-4b7e-416a-8e0a-9a9466ab7bc9 | 5 | public int solCoinNO() {
int[][] tabSol = new int[tableau.length-1][tableau[0].length-1];
OperationMatrice.initTab(tabSol);
int demande, quantite;
int x = 0;
int y = 0;
int sol = 0;
OperationMatrice.afficheTab(tableau);
demande = getDemande(x);
quantite = getQuantDisp(y);
while(demande != 0)... |
249498c2-f7ef-4044-9ffb-7ab2c63947d5 | 3 | private static String swapCases(String str)
{
String cases;
char c;
cases = "";
for(int i = 0; i < str.length(); i++)
{
c = str.charAt(i);
if(Character.isLetter(c))
{
if(Character.isUpperCase(c))
{
c = Character.toLowerCase(c);
}
else
{
c = Character.toUpperCase(c);
... |
e67bbaa5-4c1f-40cb-ad70-61723537b700 | 3 | private final void loadZuordnung() {
if (zuordnung == null) {
zuordnung = new Properties();
}
try {
InputStream in;
File propsFile = new File(StaticString.ZUORDNUNGS_PROPS_NAME);
if (propsFile.exists()) {
in = new FileInputStream(propsFile);
zuordnung.load(in);
in.close();
} else {
... |
9f1c824a-04ed-4ed3-afb7-09db1486f01c | 7 | @Override
public boolean activate() {
return (Game.getClientState() != Game.INDEX_MAP_LOADED
|| (Game.getClientState() == Game.INDEX_MAP_LOADED && AIOsmelter.stop == 1000)
|| AIOsmelter.client != Bot.client()
|| (Walking.getEnergy() == 100 && !Walking.isRunEnabled())
|| Widgets.get(640, 30).isOnScr... |
934b4f5f-1d23-4dcd-ae56-d27d2ba2438d | 2 | public UnigramCountsModel<String> getStateToState(String s) {
if (s==null)
{ return null; }
UnigramCountsModel<String> stateModel=EntityClassPairCounts.get(s);
if (stateModel==null) {
stateModel=new UnigramCountsModel<String>();
}
return stateModel;
} |
77aed82a-d842-446a-a320-8ba3dac502ad | 4 | @Override
public int compareTo(Tyopaiva tyopaiva) {
if (this.getAlku().get(Calendar.YEAR) == tyopaiva.alku.get(Calendar.YEAR)
&& this.getAlku().get(Calendar.DAY_OF_MONTH) == tyopaiva.alku.get(Calendar.DAY_OF_MONTH)
&& this.getAlku().get(Calendar.MONTH) == tyopaiva.alk... |
6dada6b0-14f8-476a-94fd-0799562ad09a | 4 | private static int[] raster16to32(int[] paramArrayOfInt, int paramInt1, int paramInt2)
{
int[] arrayOfInt = new int[paramInt1 * paramInt2];
int i2 = (paramInt1 + 1) / 2;
for (int i3 = 0; i3 < paramInt2; i3++)
{
int i = 16;
for (int i4 = 0; i4 < paramInt1; i4++)
{
int j = paramArrayOfInt[(i3 * i2 +... |
60523dfd-7a5a-4012-83b6-91f8f2d1011b | 2 | public static void main(String[] args) {
Result result = JUnitCore.runClasses(FunctionalMessageTest.class, MessageSystemTest.class, AccountServiceTest.class, FrontendTest.class, FunctionalAuthTest.class);
if (result.wasSuccessful()) {
System.out.println("All tests passed successful");
... |
093b9c42-d199-41bd-942b-553448056bad | 7 | void dumpDebug(final Prototype f) throws IOException {
int i, n;
if (strip)
dumpInt(0);
else
dumpString(f.source);
n = strip ? 0 : f.lineinfo.length;
dumpInt(n);
for (i = 0; i < n; i++)
dumpInt(f.lineinfo[i]);
n = strip ? 0 : f.locvars.length;
dumpInt(n);
for (i = 0; i < n; i++) {
LocVars ... |
c35379e0-a847-4815-8595-f7de1add4374 | 3 | public void setName(String name) throws IllegalArgumentException {
if(!name.matches(NAME_PATTERN) || name.length() < 3 || name.length() > 45) throw new IllegalArgumentException("Invalid name");
this.name = name;
} |
3d7ceb23-6cac-4228-9a15-64ca61297a6d | 9 | public void addPrice(QueryPrice price) {
if (price == null) {
System.out.println("ERROR: The price given to the query was null");
return;
}
boolean greaterThan = price.isGreaterThan();
Integer priceValue = price.getPrice();
if (priceValue == null) {
System.out.println("ERROR: The Integer val... |
c913c582-a074-440e-aacf-ee338506904d | 7 | public void updateButtons(int discardAmount, int totalAmount, ResourceType resource){
if(totalDiscardSelected == totalResources/2){
if(discardAmount < totalAmount){
if(discardAmount == 0){
discardView.setResourceAmountChangeEnabled(resource, false, false);
}
else{
discardView.setResourceA... |
642848c2-7015-4150-acd9-53198cc584a6 | 0 | public AppTest( String testName )
{
super( testName );
} |
38c84f73-81dd-48ed-8f26-5fd20d0ff034 | 1 | private void panelImage1MousePressed(java.awt.event.MouseEvent evt) {
if (empezar) {
this.mvnt_flappy.setVelocidad(aumentarVelocidad());
this.mvnt_flappy.setSaltar(true);
jFlappy.requestFocus(true);
Sonido.saltar();
}
} |
1a5d76b4-8b28-4b85-bdff-97850da4d8dd | 8 | @Override
public CommandResponse doHandle(Command command) {
DiceSet diceSet = gameState.getDiceSet();
if (command == GameCommand.TERMINATE) {
running = false;
}
else if(command == GameCommand.REROLL) {
if (currentRerolls < getMaxRerolls()) {
... |
cbf63b1e-c22b-417b-b2f4-5a2866e352b7 | 3 | private boolean isInvalidate(Processo proc) throws Exception{
List<Processo> lista = retrieveAllProcessoCliente(proc.getCliente().getCodCli());
Date now = new Date(System.currentTimeMillis());
int m = now.getMonth() + 1;
for(Processo p : lista){
if(proc.getTipo().getTipo().equals(p.getTipo().getTipo())... |
9c09880b-b0ba-4394-b160-ebaad8f06af7 | 6 | @Override
protected boolean execute(final CommandSender sender, final Command command, final String label, final List<String> args, final Region region) {
final String newName = RegionExecutor.parse(args, 0, "<New>", sender);
if (newName == null) return false;
// deny if name conflict
... |
64e1eb3c-8792-4098-a1d5-d74a27200eba | 5 | @Override
public void actionPerformed(final ActionEvent event) {
switch (event.getActionCommand()) {
case COMMAND_ALG_1:
processAlgorithm(new ToneMappingAlg1());
break;
case COMMAND_ALG_2:
processAlgorithm(new ToneMappingAlg2());
break;
... |
390597dd-3bbc-452c-bc41-4aa7539e9ecd | 5 | private final void method3998(byte i, int i_113_, int i_114_,
r_Sub2 var_r_Sub2) {
anInt8254++;
int[] is = ((s_Sub2) this).anIntArrayArrayArray8268[i_113_][i_114_];
if (i != -82)
method3981(null, null);
int[] is_115_
= ((s_Sub2) this).anIntArrayArrayArray8234[i_113_][i_114_];
int i_116_ = is.length... |
cb7c3e04-e352-4611-ab8e-3cde9b472ba4 | 9 | public void run() {
initialize();
Map<Integer, Boolean> keyStates = new HashMap<Integer, Boolean>();
framesPerSecond = FPS;
long lastFrame = System.nanoTime();
while (running) {
render();
Display.update();
if (isNewEvent(keyStates, Keyboard.KEY_L)) {
if (earthLockRotationX == -1)
earthLockRo... |
28758034-5d17-48a8-b32d-d26307ea2bff | 7 | public void passEigenValues(
double[] eigenValues,
double[][] eigenVectors )
{
double limit;
if ( relative )
{
double max = -1.0;
for ( int i = 0; i < eigenValues.length; ++ i )
if ( max < Math.abs(eigenValues[i]) )
max = Math.abs(eigenValues[i]);
limit = max * this.limit;
}
else
limit = this.limi... |
051ebbe2-a7ef-4966-917e-f095ba0ace01 | 7 | public void writeNext(String[] nextLine) {
if (nextLine == null)
return;
StringBuilder sb = new StringBuilder(INITIAL_STRING_SIZE);
for (int i = 0; i < nextLine.length; i++) {
if (i != 0) {
sb.append(separator);
}
String nextEl... |
a1b87487-d10c-4851-959d-72f2ca703c9f | 2 | @Override
public boolean isRowEmpty() {
if (!parser.isFlagEmptyRows()) {
// flag empty rows needs to be set for this functionality
// throw an exception
throw new FPInvalidUsageException("Parser.isFlagEmptyRows(true) must be set before using isRowEmpty()");
}
... |
c7dc57c0-29a4-4b7c-a2e8-0d536725f959 | 4 | public Object getFieldValue(_Fields field) {
switch (field) {
case FIRST_NAME:
return getFirstName();
case LAST_NAME:
return getLastName();
case STATUS:
return getStatus();
case ID:
return Integer.valueOf(getId());
}
throw new IllegalStateException();
} |
87530599-4212-4e26-bc8e-087b1aa8f261 | 8 | int checkBlockLine(int[] var1, int[] var2) {
int[] var3 = new int[]{0, 0, 0};
byte var4 = 0;
byte var5;
for(var5 = 0; var4 < 3; ++var4) {
var3[var4] = var2[var4] - var1[var4];
if(Math.abs(var3[var4]) > Math.abs(var3[var5])) {
var5 = var4;
}
}
... |
20826250-0b41-46ae-bf01-772200177100 | 4 | private List<Directive> parseUIControl(Element searchIn) {
List<Directive> directives = new ArrayList<Directive>();
/* First we get all the uicontrols because that is the root of a user action */
try {
NodeList uiControls = (NodeList) XMLUtils.getExpr((".//uicontrol")).evaluate(sea... |
bf5f7036-ea25-48fb-88e1-f56b6e3f7666 | 7 | public static int spawn_in_out_err_wait(String command, String infile, String outfile,
String errfile, boolean wait) {
Process p;
try {
p = Runtime.getRuntime().exec(command);
} catch (IOException e) {
return -1;
}
try {
if (infile != null) {
(new Xfer(new FileInputStream(infile), p.getOutpu... |
44aa795a-ba44-45db-b8bd-e2b63eaae7ef | 5 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
fillMap();
while ((line = in.readLine()) != null && line.length() != 0) {
boolean rev = isReverse(line);
boolea... |
d84e3215-2c76-47de-a42c-e809fed71535 | 9 | @Override
public void update(GameContainer container, StateBasedGame game, int delta)
throws SlickException {
TowerGame tg = (TowerGame) game;
Input input = container.getInput();
if (input.isKeyPressed(Input.KEY_NUMPAD1))
playBeep1();
if (input.isKeyPressed(Input.KEY_NUMPAD2))
playBeep2();
if ... |
45ea233c-1399-4b42-a8ac-a684c12be32b | 8 | public List<Sessao> Buscar(Sessao filtro) {
try {
String sql = "select * from Sessao ";
String where = "";
if (filtro.getDataInicio() != null) {
where = " dataInicio > " + filtro.getDataInicio();
}
if (filtro.getDataTermino() != null)... |
37c8651d-a252-4315-8718-871bf1c1f593 | 2 | public void mobInteract(AbstractMob mob){
Item weapon = getItemInSlot(PlayerInfo.WEAPONSLOT);
if (weapon != null){
if (attackTimer == 0){
attackTimer = weapon.getAttackSpeed();
mob.damage(weapon.getDamageDealt());
}
}
} |
127ea602-bdf7-4c51-8562-930b6ac1459b | 8 | public int maxProfit(int[] prices)
{
if (prices.length <= 1)
return 0;
int[] firstProfits = new int[prices.length];
int minPrice = prices[0];
int firstProfit = 0;
for (int i = 0; i < prices.length; ++i)
{
if (prices[i] < minPrice)
... |
5d14a94d-de73-4b1d-bf07-4bc55ad547c2 | 4 | public static void main(String[] args) throws IOException {
int port = 51325;
threads = new ArrayList<ServerThread>();
persist = new ServerPersistence();
PlayerManager.init();
ChannelManager.init();
System.out.println("MCNSAChat3 Server v1");
System.out.println("Loading data...");
load();
System.out.... |
1976875e-e828-4111-a28f-af3f7ee05c48 | 1 | public long nextTransition(long instant) {
return (instant < transition ? transition : transition + 180L * DateTimeConstants.MILLIS_PER_DAY);
} |
ae5815be-b6cc-472f-a872-d00e9cbd1397 | 2 | public void startSailing(){
while(waypoints.isEmpty()){
System.out.println("No waypoints to go to...");
com.requestData("waypoints");
try{
Thread.sleep(5000);
}catch(InterruptedException ex){
ex.printStackTrace();
}
}
sail();
} |
40b39484-3195-4f75-8b06-a3ff299b6c15 | 4 | public boolean equals(Object o) {
if (o instanceof CPRect) {
CPRect r = (CPRect) o;
return left == r.left && right == r.right && top == r.top && bottom == r.bottom;
}
return false;
} |
f0652cc3-c860-40f4-a122-66dedd3dd6be | 9 | public static void main(String[] args) throws Exception {
Options options = new Options();
options.addOption(new Option("g", false, "use dictionary mode"));
options.addOption(new Option("s", "source", true, "source file"));
options.addOption(new Option("t", "target", true, "target file... |
90c25900-c6ec-47b3-9bb4-28f710aabab3 | 8 | @Override
public void executeTask() {
waitForDefaultGateway();
String defGateway = DCServer.GetDefaultGateway();
System.out.println("=====================================");
System.out.println("Looking for server");
System.out.println("Default gateway: " + defGateway);
System.out.println("================... |
d93a3f45-c1b0-4a97-9cfe-61d0b725859c | 5 | private void writeFiles(ArrayList<Class<?>> annotatedClasses)
{
writer.setConfigurableClass(configurable);
writer.setDirectory(out);
ArrayList<Exception> errors = new ArrayList<>();
for(Class c : annotatedClasses)
{
try {
writer.writeClass(c);
... |
bfd067bb-bb77-4e0c-88c3-f18c5725a46e | 9 | public Paintable(ViewType viewType, Object modelObject) {
this.viewType = viewType;
this.setModelObject(modelObject);
((ModelConnetor)this.modelObject).setPaintable(this);
this.viewAble = true;
switch (this.viewType) {
case UT:
image = new ImageIcon(getClass().getClassLoader().getResource("\\Resources\\u... |
2bc5cb2d-5bdf-4e59-8d49-aa11789fb06e | 0 | public int getNumParameters() { return this.numParameters; } |
1507cea6-0952-46e2-a669-b6acba064709 | 9 | static void choose(int current){
if(chosen.size()==chosenN){
boolean[] selected = new boolean[n-1];
for(int i=0; i<chosenN; i++) selected[chosen.get(i)] = true;
cols = new int[n][chosenN+1];
for(int i=0; i<n; i++){
int sum = 0;
int ... |
6804fd74-db64-45b1-8334-217d13d6f24a | 4 | private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
// TODO add your handling code here:
// al darle aceptar para que registre usuario
nick = jTextField1.getText();
sitioweb = jTextField7.getText();
nombrecomp = jTextF... |
636cccfa-116c-435d-a906-b4e442eaa0d6 | 9 | BooleanScorer(Similarity similarity, int minNrShouldMatch,
List<Scorer> optionalScorers, List<Scorer> prohibitedScorers) throws IOException {
super(similarity);
this.minNrShouldMatch = minNrShouldMatch;
if (optionalScorers != null && optionalScorers.size() > 0) {
for (Scorer scorer : optionalSc... |
bd389311-7b0f-4a5b-97f2-0bbb47e1c504 | 5 | public boolean canStart(MapleCharacter c, Integer npcid) {
if (c.getQuest(this).getStatus() != 0 && !(c.getQuest(this).getStatus() == 2 && repeatable)) {
return false;
}
for (MapleQuestRequirement r : startReqs) {
if (!r.check(c, npcid)) {
return false;
}
}
return true;
} |
2871046f-2360-4093-8860-80261ae70177 | 1 | public void updateParentType(Type otherType) {
setType(otherType);
if (parent != null)
parent.updateType();
} |
eac76638-be36-4a4d-837d-c718f29007ac | 1 | public static String getString(String key) {
try {
return ResourceBundle.getBundle(BUNDLE_NAME + langCode).getString(key);
} catch(MissingResourceException e) {
return '!' + key + '!';
}
} |
829c65c0-2502-49a7-89a2-0a43749d4fab | 1 | public void start() {
if (started) return;
started = true;
setPort(portNumber);
enableCORS("*", "*", "*");
Injector injector = Guice.createInjector(new MainModule());
Controller controller = injector.getInstance(Controller.class);
controller.publish();
... |
66308e9c-6427-4b18-91c1-959fda4ec458 | 7 | public int checkFullRows(){
int totalFullRows = 0; //Nombre de ligne complètes sur le plateau
int row = -1; //Numéro de ligne
int count = 0; // Nombre de ligne complète successives
for (int i = 0; i < height; i++) {
if(isRowFull(i)){
if(row == -1){
... |
a299c1cb-e6f7-4f6e-b0a2-a5df6844fa5a | 5 | private boolean checkRoomCapacity(ArrayList<Module> modules, ArrayList<Room> rooms){
int maxRoomSize=0;
int maxModuleSize=0;
for(Module module:modules){
if (maxModuleSize<module.getModuleSize()){
maxModuleSize=module.getModuleSize();
}
}
for(Room room:rooms){
if (maxRoomSize<room.getCapacity()... |
4fdbf815-d2e2-42dc-9ceb-87b4b06da926 | 5 | private void sendChainedMessages(Feed feed, List<String> messages) {
String chain = feed.getName() + ": ";
final String SEPARATOR = " | ";
boolean isFirstMessageInChain = true;
ListIterator<String> iterator = messages.listIterator( messages.size() );
while ( iterator.hasPrevious... |
8fae4ed5-4d0b-43b7-b772-82a2d74ed0f3 | 0 | @Id
@GenericGenerator(name = "generator", strategy = "increment")
@GeneratedValue(generator = "generator")
@Column(name = "cash_count_id")
public int getCashCountId() {
return cashCountId;
} |
1e6aeac6-d44e-4e94-8a30-520c47201e70 | 1 | public void WriteData(byte[] data) throws IOException {
Packet p = pm.getPacket(data[0]);
if (p != null) {
PacketSentEvent event = new PacketSentEvent(this, pm.server, p);
pm.server.getEventSystem().callEvent(event);
}
writer.write(data);
writer.flush();
} |
a9e1b8df-66f2-4d10-b3af-ed7695abba8a | 6 | public static String pressureUnitIndexToString(int index) {
switch (index) {
case 0:
return "hPa";
case 1:
return "kPa";
case 2:
return "psi";
case 3:
return "bar";
case 4:
... |
faabf223-6799-4882-8c0b-ae5ca0b9e661 | 1 | @Override
public Insets getBorderInsets(Component component) {
Insets insets = new Insets(1, 1, 3, 3);
if (mTitle != null) {
insets.top += TextDrawing.getPreferredSize(mFont, mTitle).height;
}
return insets;
} |
5a1bb181-d04d-4f1c-a199-4566185ad68e | 2 | public static <K, V extends Comparable<? super V>> Map<K, V>
sortByValue( Map<K, V> map )
{
List<Map.Entry<K, V>> list =
new LinkedList<Map.Entry<K, V>>( map.entrySet() );
Collections.sort( list, new Comparator<Map.Entry<K, V>>()
{
public int compare( Map.Entry<K, V> o1, Map.Entry<K, V>... |
d4a838bf-a45f-42be-ac16-1aba387f2cdd | 4 | private boolean contains(char[] argString, boolean argIsWord) {
Node node = getNode(argString);
return (node != null && node.isWord() && argIsWord) || (!argIsWord && node != null);
} |
28349140-9307-4f40-9632-f7e17a211984 | 4 | public ImportHistoryUI(Shell parent) {
shlImport = new Shell(parent, SWT.DIALOG_TRIM);
shlImport.setSize(348, 226);
GridLayout layout;
gl_shlImport = new GridLayout();
gl_shlImport.numColumns = 3;
shlImport.setLayout(gl_shlImport);
shlImport.setText("Search");
shlImport.addShellListener(... |
930841b5-bc8d-4e41-a125-68252dba8346 | 0 | public void setAttributes(Hashtable attributes) {
this.attributes = attributes;
} |
9609f838-34cb-4d4e-b884-dc4f41d07484 | 1 | public String toString() {
StringBuffer sb = new StringBuffer(super.toString());
for (int i = 0; i < myTapes.length; i++) {
sb.append(" TAPE ");
sb.append(i);
sb.append(": ");
sb.append(myTapes[i].toString());
}
return sb.toString();
} |
f171a331-32d0-49ad-a859-6843eb2d2fd6 | 2 | public boolean isLangAllowed(String lang) {
for(byte i = 0; i < LANGS_COUNT; ++i)
if(lang.equals(LANGS[i]))
return true;
return false;
} |
ef37133c-ec76-47a9-b60f-270d1f4b9008 | 2 | private int max(int[] values) {
int max = 0;
for (int i=0; i<values.length; i++) {
if (values[i] > max) {
max = values[i];
}
}
return max;
} |
1bff28e5-cb2b-4126-9508-600c04ab7621 | 3 | public void addIfaces(Collection result, ClassIdentifier ancestor) {
ClassInfo[] ifaceInfos = ancestor.info.getInterfaces();
for (int i = 0; i < ifaceInfos.length; i++) {
ClassIdentifier ifaceident = Main.getClassBundle()
.getClassIdentifier(ifaceInfos[i].getName());
if (ifaceident != null && !ifaceident... |
425ac70b-09c5-4feb-9e09-0d4ddfbffd5f | 4 | @Override
public boolean register(Game g, Rack r) {
super.register(g, r);
//TODO: fix this here!!!
//Change game configuration
if (net == null || rack_size != g.rack_size){
rack_size = g.rack_size;
int inputs = USE_PROB ? rack_size : rack_size*3,
hidden = USE_PROB ? rack_size*2 : rack_size*4;
n... |
eaf68fda-9189-4093-ad68-ca2924b75916 | 3 | private boolean setArgument(char argChar) throws ArgsException {
if (isBooleanArg(argChar))
setBooleanArg(argChar, true);
else if (isStringArg(argChar))
setStringArg(argChar);
else if (isIntArg(argChar))
setIntArg(argChar);
else
return fals... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.