method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0cb9621f-6cda-4ac4-9026-813467a4e938 | 9 | private Map<Position, Tile> initGrid() {
HashMap<Position, Tile> map = new HashMap<Position, Tile>();
// first, fill all with empty
for(int i = 0; i < this.sizeX; i++) {
for(int j = 0; j < this.sizeY; j++) {
map.put(new Position(i, j), new Empty(i, j));
}
}
// central wall
for(int i = this.cent... |
7126d84b-70f7-4ba8-8a11-ec1596df4d0b | 3 | public static boolean isBlank(CharSequence cs) {
if (null == cs)
return true;
int length = cs.length();
for (int i = 0; i < length; i++) {
if (!(Character.isWhitespace(cs.charAt(i))))
return false;
}
return true;
} |
b32f54fb-e8ef-4adc-9f82-aecdd1650a99 | 7 | public static synchronized void setCodec( String extension,
Class iCodecClass )
throws SoundSystemException
{
if( extension == null )
throw new SoundSystemException( "Parameter 'extension' null in ... |
aab501a5-cedb-4bb9-b011-b0521e8ee23b | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Person2 person2 = (Person2) o;
if (age != person2.age) return false;
if (!name.equals(person2.name)) return false;
return true;
} |
5b57351c-f09d-4c88-b208-f0552fcc0110 | 0 | public void mouseExited(MouseEvent e) {} |
6014b11d-62c1-449b-8982-5746501c1ff7 | 6 | public boolean executeCommand(CommandSender sender, Command command, String label, String[] args)
{
if (command.getName().equalsIgnoreCase("locationalcrafting")) {
if (args.length == 0) {
// no arguments
} else {
if (args.length == 1 && args[0].equalsIgnoreCase("reload")) { // reloads config
if ... |
ec82e2f8-7c32-4745-906b-c6bc96b577ca | 5 | public static void copiaArquivo(File source, File destination) throws IOException {
if (destination.exists())
destination.delete();
FileChannel sourceChannel = null;
FileChannel destinationChannel = null;
try {
sou... |
6b446565-2456-4d20-89a3-790a2ee77f68 | 0 | public String getRole() {
return role;
} |
8bbd1f34-603b-44fc-a178-f38def3c2f0d | 8 | public BoolExpr add_sorted_theorem(Context ctx, HashMap<String, Expr> symbolTable) throws Z3Exception{
// a, begin, end
Expr a = this.a_inputs.get(0).to_smt(ctx, symbolTable );
Expr a_begin = this.a_inputs.get(1).to_smt(ctx, symbolTable );
Expr a_end = this.a_inputs.get(2).to_smt(ctx, symbolTable );
... |
539676e1-6198-466f-bab3-dc26832c88e8 | 8 | public SyrianGraph(String filename) throws IOException {
super(new ArrayList<SyrianVertex>(), new ArrayList<SyrianEdge>());
System.out.println("Reading File: " + filename);
String contents = Utils.readFile(filename);
System.out.println("Contents: " + contents);
Scanner sc = new Scanner(contents);
while (s... |
8ff4f9c6-1319-4175-89d8-fdc3d6311871 | 8 | private short[][] createNewSelection(int nx, int ny)
{
int cx = nx - asx, cy = ny - asy;
short[][] newsel = new short[getTilesWide()][getTilesHigh()];
for (int x = 0; x < getTilesWide(); x++)
for (int y = 0; y < getTilesHigh(); y++)
newsel[x][y] = -1;
for... |
29d12309-f774-4d6e-8ff4-4dedc7b77ae1 | 3 | private String paragraphToString(AbstractComponent component)
throws BookException {
StringBuilder sb = new StringBuilder();
try {
Iterator<AbstractComponent> iterator = component.getIterator();
while (iterator.hasNext()) {
AbstractComponent c = iterator.next();
if (c.getType() == EComponentType.SE... |
6bb7b169-7ef9-4d8c-82f2-d1379e336a95 | 9 | private void onModListCheck(NetClientHandler net, PacketModList packet)
{
if (DEBUG)
{
System.out.println("S->C: " + packet.toString(true));
}
ForgeHooks.networkMods.clear();
NetworkMod[] mods = MinecraftForge.getNetworkMods();
for (NetworkMod mod : mods)... |
9b2216eb-7e71-45dd-9b54-8723e21d7cf7 | 8 | public void actionPerformed(ActionEvent e) {
if (e.getSource()==agregarMaterial){
if (materialesComboBox.getSelectedItem()!= null && Controlador.getControlador().existeMaterial(materialesComboBox.getSelectedItem().toString())){
if(!contieneA(itemMateriales,materialesComboBox.getSelectedItem().toString())){
... |
3bdc5f43-ae5a-4674-a65d-62e33fee7081 | 8 | public void actionPerformed(ActionEvent e) {
if(e.getSource() == readRow){
int temp[] = new int[7];
for(int i = 0; i < 7; i++){
temp[i] = Integer.parseInt(arrRow[i].getText());
}
controller.storeRow(temp);
}
if(e.getSource() == writeRow){
controller.writeRow();
updateArray();
}
if(... |
728175cc-f5a8-419a-9ebe-95307debf52e | 1 | public byte[] getHash() {
StringBuilder sb = new StringBuilder();
Iterator<String> it = stations.iterator();
while(it.hasNext()){
sb.append(it.next() + "\n");
}
sb.append(stations.size());
return hu.digest(sb.toString().getBytes());
} |
b2bc854f-4328-4e8e-a54c-b372b8bec431 | 3 | @OnLoad
public void onLoad() {
super.onLoad();
TeamModel teamHome = DataStore.getTeam(getSched_home_team_id());
if(teamHome!=null) this.sched_home_team = teamHome;
TeamModel teamAway = DataStore.getTeam(getSched_away_team_id());
if(teamAway!=null) this.sched_away_team = teamAway;
ResultScoreModel resultSco... |
12877d21-6647-4256-b1aa-f82a78f5faea | 2 | @Override
public List<String> splitCodeLine(String line) {
Scanner sc;
Pattern delimiterPattern = Pattern.compile("[\\,]?[\\s]+"); //splits a String on one or more white spaces, or a comma
//followed by a whitespace -> this separates each line of assembly code into bits for processing into instructions.
Lis... |
a157bf86-5c3c-4d62-ade1-7ca145a86dd9 | 1 | @Override
public void redo() {
JoeTree tree = parent.getTree();
// Remove node from visible nodes cache
tree.removeNode(oldNode);
// Swap the nodes
parent.removeChild(oldNode, index);
if (newNode != null) {
parent.insertChild(newNode, index);
// Insert the node into the visible nodes cac... |
d8bb44da-5ed2-4d2a-99b7-a5abf0562346 | 9 | private ArrayList algorithm1(String S, String T) {
ArrayList candidateList = new ArrayList();
int bound = (int) (1.0 / tr);
for (int t = 0; t < S.length(); t++) {
char chT = S.charAt(t);
double lastTr = -1;
for (int u = Math.max(0, t - bound), flag = 0;
u < Math.min(t + bound + ... |
4fbcd3fc-87c6-4393-a663-3fd3b11b9780 | 3 | public IllegalOrphanException(List<String> messages) {
super((messages != null && messages.size() > 0 ? messages.get(0) : null));
if (messages == null) {
this.messages = new ArrayList<String>();
}
else {
this.messages = messages;
}
} |
8fb2655c-e6f0-4e91-b8ef-7d8f6b2fa7a8 | 8 | public List<Request> getAllBlocksLeft(){
//count blocks.
if(complete){return null;}
List<Request> list =new ArrayList<Request>();
SubPiece last=null;
//TODO: simplify? bit incomprehensible
int i = 0;
Iterator<SubPiece> itor = data.iterator();
while (itor.hasNext()) {
SubPiece sp = itor.next();
if... |
edc28779-39c0-42e1-b313-f623b60d31ea | 8 | public void renderStationaryEntity(StaticEntity entity){
Camera camera = raycaster.getCamera();
Screen screen = raycaster.getBuffer();
double x0 = 0, x1 = 1;
double[] rot1 = Geometry.rotatePoint(entity.getX1(), entity.getZ1(), camera.getX(), camera.getZ(), this.sin, this.cos);
... |
38b8612a-365a-4efe-802a-a5ed9d0123bb | 8 | public int doLogin() throws Exception
{
PreparedStatement psDoLogin;
PreparedStatement psDetermineUser;
ResultSet rsDoLogin = null;
ResultSet rsDetermineUser = null;
String sqlDoLogin = null;
int isLoginValidate = 0;
Connection conn = ConnectionUtils.getConnection();
... |
b251ed52-2fd9-43bb-8f11-1ebfd5a83cd9 | 0 | @Test
public void testArea_Body() {
System.out.println("geArea_Body");
assertEquals(6.0, new Cylinder(3,2,2.8).getArea_Body(), 0.00001);
} |
6fd3c756-adb0-4abd-aef4-6f7310e0ed6d | 8 | Alternating(Model model, ArrayList<Agent> _agents, Intersection[][] intersection, AnimatorBuilder builder) {
int rows = MP.getRows();
int columns = MP.getColumns();
boolean westToEast = false;
boolean isStreet = true;
for (int i = 0; i < rows; i++) {
CarHandlerList street = new CarHandlerList... |
7a3d7b2e-ee48-4a3e-b5ec-676bce196b92 | 4 | public int count(Item item) {
if (item instanceof ResourceItem) {
ResourceItem ri = findResource(((ResourceItem)item).resource);
if (ri!=null) return ri.count;
} else {
int count = 0;
for (int i=0; i<items.size(); i++) {
if (items.get(i).matches(item)) count++;
}
return count;
}
return 0;
... |
4824955c-9abe-45a3-a28e-a47aa47aa898 | 1 | protected void initDefinition(Method method) throws DaoGenerateException {
checkBeforeParse(method);
// 解析方法参数
Class<?>[] paramTypes = method.getParameterTypes();
Annotation[][] annotations = method.getParameterAnnotations();
Map<String, Integer> paramIndexes = new HashMap<String, Integer>(8, 1f);
Map<Stri... |
70715a25-9d38-4f66-ad44-70965741c7df | 0 | @Override
public void windowActivated(WindowEvent e)
{
} |
5772d963-57c9-4565-a3d2-2d678beed05d | 7 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((affected!=null)
&&(affected instanceof MOB)
&&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker()))
&&(msg.sourceMinor()==CMMsg.TYP_QUIT))
{
... |
7e628a81-1920-480c-b224-f2562547c19d | 5 | public static Format_Code fromInt( int val ){
switch ( val ) {
case 0x0001 : return WAVE_FORMAT_PCM;
case 0x0003 : return WAVE_FORMAT_IEEE_FLOAT;
case 0x0006 : return WAVE_FORMAT_ALAW;
case 0x0007 : return WAVE_FORMAT_MULAW;
cas... |
1be5bebd-61c4-4881-979b-c6b446918808 | 8 | @Override
public FiveCardOmahaHiLoWorker build()
{
if (super.getRounds() <= 0) {
throw new IllegalStateException("The number of rounds must be a strictly positive number");
} else if (super.getProfiles() == null || super.getProfiles().size() < 2) {
... |
1c1c5627-dad0-4302-919b-8f8f24c10595 | 6 | static private int jjMoveStringLiteralDfa9_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(7, old0, 0L);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(8, active0, 0L);
return 9;
}
switch(curChar)
{
... |
3d21caf5-8a50-493f-8fda-7d4f02a7dc57 | 6 | @EventHandler
public void EnderDragonRegeneration(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.getEnderDragonConfig().getDouble(... |
8ae48c43-59cd-4bdb-9ff4-dae00af43708 | 5 | public static short getShort(byte[] b, int offset) {
if (isBlank(b)) {
throw new IllegalArgumentException("blank byte array.");
}
if (offset < 0) {
throw new IllegalArgumentException("invalid array offset:" + offset + ".");
}
short out = (short) (b[0] < 0 ? -1 : 0);
for (int l = b.length - offset, i =... |
a9afa637-6043-43e5-9bd4-dc164cf6f58a | 5 | public static void swap(IntegerStack one,int oneLim,
IntegerStack other,int otherLim) {
// this is used for swapping labels in logical expressions compilation
// usually there are not so many labels to swap... and the element
// by element copy should not incur significant peforman... |
e166a6fa-6d94-4adf-9f1e-048e904d67f6 | 8 | public void weather()
{
if (hour24 > 6 && hour24 <= 12)
{ nightTime = false;
eveningTime = false;
afternoonTime = false;
morningTime = true;
setTime();
}
if (hour24 > 12 && hour24 <= 18)
{ nightTime = false;
eveningTime = false;
morningTime = false;
afternoonTime = true;
... |
9be004f6-8243-472b-bb23-37ed115499a1 | 0 | @Override
public void handleIOException(SharingPeer peer, IOException ioe) {
logger.error("I/O problem occured when reading or writing piece " +
"data for peer " + peer + ": " + ioe.getMessage());
this.stop();
this.setState(ClientState.ERROR);
} |
629394b5-be5b-4986-a53e-0a6dbb1809e8 | 6 | static public List<GenericDatabase> populateDatabaseList()
{
List<GenericDatabase> databaseList = new ArrayList<GenericDatabase>();
File databaseDir = new File("Databases");
// if the directory does not exist, create it
if (!databaseDir.exists())
{
System.out.println( "creating Databases Directory" );
... |
3c07518f-3878-4500-be83-a64ab6e59594 | 9 | public void genFile()
{
FileWriter baseGen = null;
String eol = System.getProperty("line.separator");
try
{
baseGen = new FileWriter(myInfo.USBGen.getWriteableString()+"RemoteBoot.rcf");
//Build the file header
baseGen.write("Remote Boot Information;" + eol);
//Sets the reset
baseGen.write(">R... |
d50ec24b-d88d-4ac5-9646-c70f3978d6a8 | 4 | @Override
public void setCenterLocation(double x, double y) {
super.setCenterLocation(x, y);
if (!lastLocations.isEmpty()) {
// do some averaving to show some intermediate positions for
// fast-moving object (rifle projectiles)
if (lastLocations.size() > 1) {
double[] c1 = lastLocations.get(lastLocat... |
9e3d6dfa-1f94-440a-80b4-acae5bee700d | 7 | public boolean ensureMinimums(int minMaxDS, int minMaxSize, long minMaxTime) {
boolean corrected = false;
if(stdCloseConditions.maxContAnzDS < minMaxDS) {
corrected = true;
stdCloseConditions.maxContAnzDS = minMaxDS;
}
if(stdCloseConditions.maxContSize < minMaxSize) {
corrected = true;
stdCloseCondi... |
e8dea5eb-c477-4589-8645-5f32aca9f5ba | 5 | public static void main(String[] args) {
Persoon p1 = new Persoon("Sander", "SchijfStraat 26B", "Teteringen");
Persoon p2 = new Persoon("Jeroen", "SchijfStraat 26B", "Teteringen");
Persoon p3 = new Persoon("Femke", "SchijfStraat 26B", "Teteringen");
ArrayList<Persoon> lijst = new ArrayList<Persoon>();
lijst... |
ba2c701e-0e85-431b-97ae-b566680c0660 | 6 | final int method2584(int[] is, int i, int i_115_, RasterToolkit[] class105s,
int i_116_, int i_117_, int i_118_, aa var_aa,
int i_119_, int i_120_, int i_121_, int i_122_,
int i_123_, boolean bool, int i_124_, String string) {
try {
if (bool != false)
getWidget(41);
anInt4057++;
return met... |
f581a466-0500-4c83-880c-e30e043c3d0f | 4 | private void writeParameters(BufferedWriter writer) throws IOException{
int paramSize = this.configs.size();
for (int i=0; i<paramSize;i++){
int params=this.configs.get(i).size();
if (params==3){
writer.write(this.configs.get(i).get(0)+","+this.configs.get(i).get(1)+","+this.configs.g... |
0fdb76d5-35ba-4726-a83d-745615e1c319 | 5 | private void buildResponse() throws IOException {
switch (request.getMethod()) {
case "GET":
case "POST":
Helper.buildGETorPostResponse(request, response);
break;
case "OPTIONS":
buildOPTIONSResponse();
break;
case "HEAD":
buildHEADResponse();
break;
case "TRACE":
buildTRACEResponse();... |
5efa306d-27f2-4917-9f41-219f1791f34b | 2 | private void addRetPhi(final Subroutine sub, final Block block) {
if (phis[cfg.preOrderIndex(block)] != null) {
return;
}
final VarExpr target = (VarExpr) prototype.clone();
final PhiReturnStmt phi = new PhiReturnStmt(target, sub);
phis[cfg.preOrderIndex(block)] = phi;
if (SSA.DEBUG) {
System.out.p... |
747134c3-d1de-414b-aa5e-91ad65cab805 | 3 | public DisplayMode findFirstCompatibleMode(
DisplayMode modes[])
{
DisplayMode goodModes[] = device.getDisplayModes();
for (int i = 0; i < modes.length; i++) {
for (int j = 0; j < goodModes.length; j++) {
if (displayModesMatch(modes[i], goodModes[j])) {
... |
4f1808f3-22d6-4646-8f3a-6ac02b7144f2 | 1 | public void peek() throws IOException {
if (!cached) {
next();
}
cached = true;
} |
ab20dc74-b8a6-41a3-a845-5ea46eeb0db7 | 7 | void initResources() {
final Class<ControlExample> clazz = ControlExample.class;
if (resourceBundle != null) {
try {
if (images == null) {
images = new Image[imageLocations.length];
for (int i = 0; i < imageLocations.length; ++i) {
InputStream sourceStream = clazz.getResourceAsStream(im... |
4c8a31f7-c5c5-4a4a-9edc-bc93ecd27315 | 9 | public static byte[] decode(String s) {
int end = 0; // end state
if (s.endsWith("=")) {
end++;
}
if (s.endsWith("==")) {
end++;
}
int len = (s.length() + 3) / 4 * 3 - end;
byte[] result = new byte[len];
int dst = 0;
try {
for (int src = 0; src < s.length(); src++) {
int code = charSet.in... |
e17c0b10-dd2e-4011-b570-866b7d149ccb | 5 | public Embed(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "height":
height = Height.parse(this, v);
break;
case "src":
src = Src.parse(this, v);
break;
... |
8f0581ce-0ec6-446e-8a14-de6e348ea34d | 7 | private static String jovoKijelentoTargyas(Szo szo, SzamSzemely szamSzemely) {
String szoto = szo.getSzo();
if (szoto.endsWith("ni")) {
szoto = szoto.substring(0, szoto.length() - 2);
}
switch (szamSzemely) {
case EGYES_SZAM_ELSO_SZEMELY:
return ... |
0265b503-0e02-4301-b655-90c9883f5fb2 | 6 | public static void main(String[] args) {
int numberRead = 0;
InputStream readerStream = null;
OutputStream writerStream = null;
// buffers are typically allocated in multiples of 512
byte[] buffer = new byte[512];
if (args.length < 2) {
System.out.println("Usage: java FileCopy inputfile outputfile");
... |
790e0eeb-cf1e-4d3f-90d8-5c09d0b1a137 | 0 | public AndroidEntryPointCreator getEntryPointCreator() {
return entryPointCreator;
} |
9899c9e6-ee43-4070-b605-6ccbdfb974bc | 3 | public void preProcessQuery(String fileName, String outFile, int queryCol,
HashSet<String> prodWords) {
// HashSet for storing all the stop-words
HashSet<String> stopwordsSet = new HashSet<String>();
String stopwordFile = "xbox/stopwords.txt";
FileReader fReader;
BufferedReader bReader;
try {
fReader ... |
7dd2dd2e-2095-4cd1-bbb5-1248eb2e689e | 4 | public static void main(String[] args) {
if (args.length < 1) {
System.err.println("Too few arguments.");
System.exit(1);
}
final AttributeSet all = makeAttributeSet(args[0]);
final Collection<FunctionalDependency> fds = new LinkedList<>();
for (int i = 1; i < args.length; ++i) {
String[] parts = a... |
a4b3a139-99a9-4284-8225-c049424d8914 | 9 | public static void main(String[] args) throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
n = Integer.parseInt(st.nextToken());
m = Integer.parseInt(st.nextToken());
s = Long.parseLo... |
c2b71b0e-e638-4f55-836c-67b2939b2007 | 9 | private boolean isValidPawnMove(int sourceRow, int sourceColumn, int targetRow, int targetColumn) {
boolean isValid = false;
if (isTargetLocationFree()) {
if (sourceColumn == targetColumn) {
// same column
if (sourceFigure.getColor() == Figure.COLOR_BLACK) {
... |
367578c1-2443-4b84-a9dd-f2e312d855fb | 3 | @SuppressWarnings("unchecked")
private void getElementsList() {
try {
List<NetworkHardware> elements;
DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
dos.writeBytes(ServerFrame.getElementsListCmd + "\n");
ObjectInputStream ois = new ObjectInputStream(socket.getInputStrea... |
f066c6fe-5873-42da-a04d-30e4cce913b2 | 7 | public void draw(Graphics g, Display d, int bottomPixelX, int bottomPixelY,
boolean drawHealth) {
double percentMoved = count * 0.25;
// Tile coordinates of The Dude (x,y)
double x, y;
if(attacking == null) {
x = this.oldX + (this.x - this.oldX) * percentMoved;
y = this.oldY + (this.y - this.oldY) ... |
5faed5f9-ac12-41e2-9cc0-c151682ba79d | 0 | public Object getjComboBoxChercher() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} |
d9758a61-600c-49b9-9fd7-8aaf8b15b37d | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TDatdslPK other = (TDatdslPK) obj;
if (!Objects.equals(this.transNo, other.transNo)) {
return... |
ee937ccc-bba8-4da2-a9bc-1588254f7386 | 0 | public boolean isReject() {
return type == REJECT;
} |
f68c9e9b-b77f-4a66-8b40-148772bbd789 | 6 | public void appMng() throws IOException
{
Scanner in = new Scanner(System.in);
System.out.println("-----------------------");
System.out.println("App Management Menu");
System.out.println("1.Create New App");
System.out.println("2.Delete App");
System.out.println("3.Edit ... |
1e8617ac-76ad-4e0e-8d53-0baf29132196 | 6 | public Vector getData(String query) throws SQLException
{
Connection connection = null;
Statement statement = null;
ResultSet result = null;
String val = "";
Vector value = new Vector();
try
{
Class.forName(driver);
connection = DriverManager.getConnection(url, username, passwd);
statement = c... |
3a36a932-1e69-4e3f-b360-1676ae4ce8da | 5 | @Override
public boolean execute(SimpleTowns plugin, CommandSender sender, String commandLabel, String[] args) {
final Localisation localisation = plugin.getLocalisation();
final Town town;
if (args.length == 0) {
if (sender instanceof Player) {
final Player pla... |
3e2b36c2-50fd-401b-9762-e4eb7712d55a | 8 | public void backMove(){
//cofa ostatni ruch
if((boardLog.getPossStart()==null)) return;
if((boardLog.getPossStart()[0]==-1)) return;
if(numbClick==1) {
JOptionPane.showMessageDialog(null, "Nie wykonales ruchu");
return;
}
boardLog.backMove(!site);
if(ai) {
if(aiDest==null) System.out.p... |
8b2babcd-39fc-423a-a035-af085c444abb | 4 | public static void main(String[]args)
{
int n = 0;
int limit = 20;
boolean test = true;
while(test)
{
n++;
for(int i = 1; i <= limit; i++)
{
if(n % i != 0)
{
//System.out.println(n + "%" + i + "=" + n % i);
break;
}
if(i == limit) test = !test;
}
}
System.out.printl... |
e93adfa5-53e9-4b43-a42c-1bb30b553709 | 9 | public double funct(double x[]) {
for (int j = 0; j < parameters.length; j++) {
parameters[j] = x[j];
}
//model run
// singleRun();
currentCount++;
//getting rid of pairs which contain missing data values
double[] preArr = prediction;
double[]... |
ea0edc89-062d-4ab4-9a16-0efee35e37a7 | 6 | public RTT.corba.CSendHandle sendOperation (String operation, org.omg.CORBA.Any[] args) throws RTT.corba.CNoSuchNameException, RTT.corba.CWrongNumbArgException, RTT.corba.CWrongTypeArgException, RTT.corba.CCallInterrupted
{
org.omg.CORBA.portable.InputStream $in = null;
try {
o... |
db87e555-767e-4731-83c0-9d7d9c38ac36 | 3 | public static int eval(double d)
{
if(d<=0.4)
return 0;
if(d<=0.7)
return 1;
if(d<=0.9)
return 2;
else
return 3;
} |
6803201a-9077-4953-94cc-98a0fb748b2b | 4 | public static boolean levehetBabuSajat( String mit, int jatekos, int[][] tabla )
{
logger.info("Bábú levétel ellenőrzés.");
int mitS = 0, mitO = 0;
int[] SorOsz = Helyezz.helyMeghataroz( mit );
mitS = SorOsz[0];
mitO = SorOsz[1];
if(mitS == -1 || mitO == -1)
{
System.out.println( "Arra a helyre nem h... |
3259fcdd-1222-44f1-abbb-db343ff124cf | 2 | public void reset() throws IOException
{
if (! markSupported()){
throw new IOException("not resettable");
}
try{
close();
myInput = new BufferedInputStream(new FileInputStream(myFile));
}
catch (FileNotFoundException fnf){
Syste... |
4f03a982-e2f6-4cb1-b459-23fc16b4806c | 7 | public static void findZeros(int[][] matrix)
{
int rows[] = new int[matrix.length];
int columns[] = new int[matrix[0].length];
int pivot = -1;
for(int i=0; i<matrix.length; i++)
{
for(int j=0; j<matrix[0].length; j++)
{
if(matrix[i][j]==0)
{
rows[i]=pivot;
columns[j]=pivot;
... |
e1c632ff-759f-407c-9130-1c2d77cfa396 | 9 | public void init() {
io = Hashtags.getIOManager();
configFile = new File(plugin.getDataFolder(), "config.yml");
config = plugin.getConfig();
if (!configFile.exists()){
io.sendConsole("Creating config.yml...", true);
try {
configFile.createNewFile();
updateConfig();
io.sendConsole("config... |
128d709a-f79f-4250-ac94-f0de9f50a661 | 6 | public AABB expand(float x, float y, float z) {
float var4 = maxX;
float var5 = maxY;
float var6 = maxZ;
float var7 = minX;
float var8 = minY;
float var9 = minZ;
if (x < 0F) {
var4 += x;
}
if (x > 0F) {
var7 += x;
}... |
f247ddd1-aef6-460e-bc41-35d542f32e10 | 9 | private void markFocusedCell(Event event, ViewerCell cell) {
Color background = (cell.getControl().isFocusControl()) ? getSelectedCellBackgroundColor(cell)
: getSelectedCellBackgroundColorNoFocus(cell);
Color foreground = (cell.getControl().isFocusControl()) ? getSelectedCellForegroundColor(cell)
: getSelec... |
2f70f4fc-4c26-4132-bc34-a61f201376b1 | 3 | public List<List<Object>> calculateGreedyMostPopularKMer() {
List<List<Object>> mostProbableKMer = new ArrayList<List<Object>>();
List<String> allKMers = getAllKMers();
double highestProbability = -1;
greedyLetterSplit(matrixList);
for (String s : allKMers) {
double... |
ca23a3c0-d617-4ece-ac09-42b4bf86e395 | 2 | public void titleOptions() {
if(Keybinds.CANCEL.clicked() || Keybinds.CONFIRM.clicked()) {
titleMenuType = TitleMenuType.TITLE;
buildTitleMenu();
}
} |
2209fc38-e078-4d78-81f0-b17ecb2587ec | 7 | public static void readFile() {
// use a bufferedReader to read the transactions into the queue
BufferedReader br;
try {
br = new BufferedReader(new FileReader("assign4/" + filename));
String line;
while ((line = br.readLine()) != null) {
int[] transData = new int[NUM_DATA];
StringTokenizer st ... |
42fb0024-c7af-493d-b5e8-492618f5005e | 9 | public SearchBar(String defaultText, String tooltip, final Component defaultComponent) {
this.defaultText = defaultText;
this.searchPanel = new CQueryField();
this.searchBar = this.searchPanel.getQueryField();
searchBar.setToolTipText(tooltip);
searchBar.setColumns(12);
... |
46b71ccb-3430-477f-afcc-30943e1d5fad | 6 | @Override
public List<String> onTabComplete(CommandSender sender, Command command,
String alias, String[] args) {
if (args.length == 1) {
List<String> matches = new ArrayList<String>();
for (String subcommand : subcommands) {
if (StringUtil.startsWithIgnor... |
3b5f2aff-a406-48c0-b00c-683b6285320f | 5 | public void run() {
ArrayList<Integer> primes = new ArrayList<Integer>();
for (int i=start;i<=stop;i+=2){
if (isPrime(i))
primes.add(i);
if (lead)
System.out.println(i+"/" + stop);
}
try {
PrintWriter print = new PrintWriter(new File(file));
for(int i=0;i<primes.size();i++... |
089445b4-1529-4bf7-b712-166d4c9bf36f | 7 | protected boolean isPrimitiveWrapper(Object input) {
return input instanceof Integer || input instanceof Boolean ||
input instanceof Character || input instanceof Byte ||
input instanceof Short || input instanceof Double ||
input instanceof Long || input instanceo... |
22e51fdd-5a95-4c09-81ea-61b7377e271f | 6 | public static void main(String[] args){
ParallelPort lpt1 = new ParallelPort(0x378);
Boolean ligado = false;
Boolean butCarregado = false;
// Input
System.out.println("\nSair!!(Ctrl-Z)");
while(true){
if(lpt1.read() != 63 && butCarregado == true){
if(ligado){
// Liga o Led
lpt1.write(1);... |
80d0d3cd-e327-4a59-957e-f1956cedba44 | 7 | public static void main(String[] args) {
if (args.length != 1) {
System.err.println("Uso: java MatrizPolinomio <archivo>");
System.exit(1);
}
try {
LectorMatrizXML lector = new LectorMatrizXML(args[0]);
int i;
System.out.println("Default " + lector.getDef... |
5970dde7-6c46-4ba8-8580-88097a37a774 | 1 | public void saveItems()
{
for (int i = 0; i < items.size(); i++)
{
TimerPreferences.getInstance().putTime("item" + i, items.get(i));
}
} |
fa4fc7e8-4aba-4634-a4f6-9c1fecec2c15 | 0 | public static void main(String[] args) {
new ChatController();
} |
9e70ab8e-7848-43c7-9d18-781ab9158279 | 1 | public FieldInfo[] getFields() {
if ((status & FIELDS) == 0)
loadInfo(FIELDS);
return fields;
} |
30ed7aac-c3b7-4f7b-8335-8253c966b09d | 4 | public int getSentenceCount() throws BookException {
int count = 0;
ArrayList<AbstractComponent> list = getSentenceList(text);
for (AbstractComponent component : list) {
HashMap<AbstractComponent, Integer> map = getWordMap(component,
new HashMap<AbstractComponent, Integer>());
Collection<Integer> freqL... |
a6b9d70f-ea8f-42b9-86a2-9dda08b6d0ca | 8 | public static void main(String args[]) {
TowerDefenseControllerTest game=new TowerDefenseControllerTest();
game.init();
// Round 1
TowerDefense_TransData data;
// paint data
// Prep
while(true){
timestamp++;
//Look up Bridge
game.checkprepBridge();
data=control.getInfo(clientId, time... |
d5330c2c-0791-4067-bd82-09f1cf5e5396 | 1 | private void setUpCollectionMenu() {
ImageButton addFile = new ImageButton(parent, "Add File", 75, 550, 100,
25, 1) {
@Override
public void onMousePress(int x, int y) {
// Adding filePath to audioPathsArray
int result = jfile.showOpenDialog(new JFrame());
if (result == JFileChooser.APPROVE_OPTIO... |
503607d2-27f2-4737-a9e1-ee525b79e5cc | 2 | static void findInRec(int l, int w){
for(int i=0;i<400;i++){
for(int j=0;j<400;j++){
validate(i, j, l, w);
// validate(...);
}
}
} |
638d318d-3efd-4d59-9412-39bceca5297b | 4 | public void draw(Graphics2D g2)
{
Rectangle r = new Rectangle(col*Puzzle.drawSize, row*Puzzle.drawSize, Puzzle.drawSize, Puzzle.drawSize);
g2.setStroke(new BasicStroke(3));
if(!selected)
{ g2.setColor(Color.BLACK); }
else
{ g2.setColor(Puzzle.stateColor); }
... |
c5872cce-4ce0-4ae3-b5ec-d804461b4fa6 | 8 | public Vector2f getDir()
{
float x = (int) (goalPosition.x-currentPosition.x);
float y = (int) (goalPosition.y-currentPosition.y);
if(x < 0)
x = -speed;
else if(x > 0)
x = speed;
if(y < 0)
y = -speed;
else if(y > 0)
y = speed;
if(x == 0 && y == 0)
{
if(goalPosition == startPosition)
... |
e79eec4a-ab3d-41f5-b68d-6514cf75b380 | 3 | private void buscar(){
GestionarCliente gc = new GestionarCliente();
ArrayList<Cliente> cBuscado = gc.buscarCliente(this.buscarPor(), textBuscar.getText());
System.out.println(opcionBusqueda);
if(opcionBusqueda){
buscar.setVisible(true);
buscar.setTitle("Resultado... |
94b2c01c-ba7d-4f67-a8d5-d45720c64cfb | 6 | public void drawSprite2(int i, int j) {
int k = 225;//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 -= ... |
01b0c524-8c03-4d35-981f-44c32c4a63b5 | 2 | public void updateRefDisplay()
{
// first clear the main display
clearMainDisplay();
// create headings for the display
String headings = String.format("%-5s%-20s%-6s%-4s%-10s%-4s",
"ID", "Name", "Qual.", "AM", "HL", "VL");
refereeDisplay.append(headings + "\n");
// create break line between headings... |
0c985fef-c88b-48d7-bb75-35fae877b779 | 3 | @Override
public boolean equals(Object o) {
if (!(o instanceof ThumbsUp)) {
return false;
}
ThumbsUp t = (ThumbsUp) o;
if (this.getAccount().equals(t.getAccount())) {
return false;
}
if (this.getReply().equals(t.getReply())) {
re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.