method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
504bc83d-8dc8-4fa9-a7e2-033cfb7ddc94 | 3 | @Override
public boolean addItemToInventory(Item item) {
if (isRoomInInventory()){
for (int i = 0; i < getInventorySize(); i++){
if (getItemInSlot(i) == null){
setItemInSlot(i, item);
break;
}
}
return true;
} else {
return false;
}
} |
0a220159-6b50-4233-a0cf-b5b40cb3f328 | 8 | public void processEvent(Event event)
{
if (event.getType() == Event.COMPLETION_EVENT)
{
System.out.println(_className + ": Receive a COMPLETION_EVENT, " + event.getHandle());
return;
}
System.out.println(_className + ".processEvent: Received Login Response..... |
815016eb-1dc4-4850-98dc-6851c829fcf7 | 4 | public void updateAnimation()
{
if (!this.active)
{
return;
}
elapsedTime += Game.delta;
if (elapsedTime > frameTime)
{
currentFrame++;
if (currentFrame == frameCount)
{
currentFrame = 0;
... |
3ee70412-382d-4104-88a2-a6c530fe4fb6 | 7 | @Override
protected LiveWeatherBean parseLine(String line) {
LiveWeatherBean bean = new LiveWeatherBean();
try {
String[] items = line.split(",");
bean.setLinkId(Integer.parseInt(items[0].trim()));
Date time;
if (items[3].trim().equals("") || items[3].trim() == null)... |
61de20c6-0687-412f-a565-54c9e4731303 | 4 | public void mergePERanges() {
if(!merged && ranges.size() > 1) {
sortRanges();
int i = 0;
do {
PERange cr = ranges.get(i);
PERange next = ranges.get(i+1);
if((next.getBegin() - cr.getEnd()) == 1) {
cr.setEnd(next.getEnd());
ranges.remove(i + 1);
continue;
}
i++;
} wh... |
ed6210f0-27e5-4598-9e03-b81e00478a46 | 3 | private String[] makeSysEqn(int dim, TfDialog tf) {
String[] xf = new String[dim];
for (int i = 0; i < dim - 1; i++)
xf[i] = "x" + (i + 2);
StringBuffer sb = new StringBuffer();
for (int i = 0; i < dim; i++) {
sb.append("-(" + tf.getA(i) + ")*x" + (i + 1));
if (i == dim - 1)
sb.append("+");
}
s... |
decc1a19-0d5d-4197-8cd9-2d66130911dc | 9 | /* */ public Object getWatcher()
/* */ {
/* 159 */ Class<?> Entity = Util.getCraftClass("Entity");
/* 160 */ Class<?> DataWatcher = Util.getCraftClass("DataWatcher");
/* */
/* 162 */ Object watcher = null;
/* */ try {
/* 164 */ watcher = DataWatcher.getConstructor(new Class[] ... |
fc39df1f-0ee7-45df-a401-dc1a5c9526c4 | 9 | public static void main(String[] args) {
for(int i=0;i<=S.length;i++){
for(int j=0;j<=S.length;j++){
Palin[i][j]= -1;
}
}
for(int j=1;j<=S.length;j++){
Palin[0][j] = 0;
}
for(int i=0;i<=S.length;i++){
Palin[i][0] = 0;
}
for(int i=1;i<=S.length;i++){
for(int j=S.length;j>=1;j--){
Pal... |
2e65ea0d-64f3-45bd-809d-bb9498107cdf | 7 | private void btn_lintDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_lintDeleteActionPerformed
// TODO add your handling code here:
if (lintProjectDir == null || !lintProjectDir.exists()) {
//Warning user!!!
// Panel1.projectDir = new File(LintScanner.... |
1f2f9d57-422c-414d-8915-f9715e8ceead | 9 | public void validateConfiguration() {
/*
*
* 1. PROLOG: REQUIRED, ALLOWED, FORBIDDEN
* 2. XMLDECL : REQUIRED, ALLOWED, FORBIDDEN
* 3. DOCTYPE : REQUIRED, ALLOWED, FORBIDDEN
*
* VALID: (RRR, RRA, RRF, RAR, RFR, ARR, AR... |
6f067090-5059-41c4-9924-4143ca59c60b | 8 | public void run()
{
File arquivoDeSom = new File(enderecoDoArquivo);
if (!arquivoDeSom.exists()) {
System.err.println("Arquivo Wave não encontrado: " + enderecoDoArquivo);
return;
}
AudioInputStream audioInputStream = null;
try { ... |
89b0d652-cd2a-469c-a511-6d9bbb5f47fe | 5 | private void selectionProjet(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_selectionProjet
int ligneSelectionnee = tableAfficheProjet.getSelectedRow();
int idProjet = (int) tableAfficheProjet.getValueAt(ligneSelectionnee, 0);
projet.setId_projet(idProjet);
dAOParticipe.equipeDansProj... |
887edebf-2a94-4c5e-aab1-81cb08aadeb0 | 3 | private boolean jj_3R_60() {
if (jj_3R_72()) return true;
Token xsp;
while (true) {
xsp = jj_scanpos;
if (jj_3_51()) { jj_scanpos = xsp; break; }
}
return false;
} |
255586d6-508f-4c28-a96c-b32f24cbba60 | 3 | public void init() throws SQLException, ClassNotFoundException {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
Connection con = getConn();
DatabaseMetaData meta = con.getMetaData();
ResultSet res = meta.getTables(null, null, null, new String[] { "TABLE" });
HashSet<String> tabName = new HashSet<Strin... |
491f0ce9-9d0f-424d-aca2-d2e0c553e8da | 4 | private static void BruteForceMethod() {
// TODO Auto-generated method stub
long total = 0;
int i=0;
int j=0;
for(i=0;i<100000;i++){
for(j=i;j<100000;j++){
if (array[i]>array[j]){
total++;
}
}
if(i%1000 == 0){
System.out.print(total);
System.out.print("\n");
}
}
... |
3663532b-4efe-42f2-8986-fe3c29ff5af8 | 4 | static void drawBoard()
{
//song.stopPlayFile();
//song.startPlayFile();
for(int i=0;i<place.length;i++)place[i]=place.length-2;
for(int i=0;i<pad.length;i++)
{
for(int l=0;l<pad[i].length;l++)
{
pad[i][l]=new Rectangle(j,startxpos,startypos,25,25,defColor);
startxpos+=35;
}
startypos+=35... |
4745ba42-d19a-47a8-9593-d53ad140d87e | 9 | private boolean isAssignedToGlobal(CoffeeScope scope, CoffeeToken token) {
if (!isAssigned(scope, token)) {
return false;
}
CoffeeToken after = scope.after(token);
while(null != after && !isTerminator(after)) {
if (isExports(after) || isAt(after) || isThis(after)... |
db12a681-62ed-4df5-82f9-747f7bad80a1 | 1 | public static void listEmployeesNoManagerCloudUnit(
EntityManager entityManager) {
TypedQuery<Employee> query = entityManager
.createQuery(
"select e from Employee e join e.projects p where p.name = 'Cloudunit' and e.manager = null",
Employee.class);
List<Employee> resultList = query.getResultLis... |
4aa6e872-16e5-451c-bb76-39a7cded5b49 | 1 | public static void logException(Exception ex) {
try {
File exLog = new File(filePath);
FileOutputStream outputStream = new FileOutputStream(exLog);
ex.printStackTrace(new PrintStream(outputStream));
outputStream.flush();
outputStream.close();
... |
a0f5de14-d324-4f44-aba6-2f5a36660dd2 | 3 | public static void SelectionSort (int[]v){
for (int indexItem=0; indexItem<v.length - 1; indexItem++){
int IndexMin= indexItem;
for(int index=1; index<v.length;index++){
if( v[index]< v[IndexMin])
IndexMin= index;
int aux=v[IndexMin];
v[indexItem]=v[IndexMin];
v[IndexMin]=aux;
... |
26537bc4-7fdd-4afe-9429-984ccc22648f | 2 | private void continueSpawnLogic2(final Player p, final PlayerData data){
System.out.println("PLAYER " + p.getName() + " LOADED SPAWN LOGIC 2");
final ClassType classChoice = data.getNextClass();
final TeamPref teamPref = data.getTeamPref();
classChoice.loadPlayerInventory(p);
Team t = teamPref.getTeam();
p.... |
92cb70b1-8360-4ff1-b346-c91f1f7efe94 | 6 | public Shell getShell(String key) {
Shell myShell = null;
try {
if (!shells.containsKey(key)) {
return null;
}
Object obj = shells.get(key);
if (obj instanceof Class) {
Class<?> shclass = (Class<?>) obj;
Meth... |
3b129af6-7f83-4510-8fd2-715460e56d50 | 4 | @Override
public boolean deconnect(EmitterInterface e) {
OVLine l = getLine((OVNode) e);
if (l != null) {
lines_.remove(l);
}
if (polymorf_ && getConnections().size()==1) {
setType(ValueType.VOID);
}
boolean flag = super.deconnect(e);
... |
48a4f319-4372-43fb-9910-6143840c562e | 3 | public int insertNewUser(String email, String password, String firstName, String lastName, String address1, String address2, String city, String state, String zip)
{
int newId = -1;
try {
// hash password with SHA1 algorithm
String hashPass = makeSHA1Hash(password);
// Convert zip code to integer
... |
e39dee72-2ece-4877-b3c6-8783d8cea73e | 2 | private void drawLeft(Graphics g) {
Direction right = backDir.getLeftDirection();
Rectangle rightDoorBound = rightDoor.getBounds();
if(tile.hasExit(right))
{
g.setColor(DOOR_COLOR);
g.fillPolygon(rightDoor);
g.setColor(DOORNOB_COLOR);
g.fillOval((int)rightDoorBound.getMinX() + DOORNOB_SIZE/2, (i... |
486fc51e-7dd0-4ada-93d0-4da90fb85ea7 | 5 | @Override
public void update(GameContainer gc, int delta) throws SlickException
{
Input ip = gc.getInput();
mouseX = ip.getMouseX();
mouseY = ip.getMouseY();
cam.update(objects.GetPlayerPos());
objects.update(bt * delta / 1000f, mouseX, mouseY, ip, cam.getPos());
// Press tab to restart
if (ip.isKeyP... |
ac739ed4-bf7f-4b06-a6a0-a7d773a59879 | 8 | @Override
public Auction bid(User user, long auctionId, double amount) {
Auction a = auctions.get(auctionId);
if (a == null)
return null;
User prevHighestBidder = a.getHighestBidder();
a.addBid(new Bid(amount, user));
// Report event
if (as != null) {
try {
as.processEvent(new BidEvent(Event... |
c61aba53-1450-4178-b41f-d42d360284bc | 8 | @Path("/admin/profiles.json")
@Produces(MediaType.APPLICATION_JSON)
@GET
public String getProfiles(
@Context HttpServletRequest request,
@Context HttpServletResponse response,
@QueryParam("json") String json ) {
if( !checkHostInfo(request.getRemoteHost(),
AdminProperties.getHttp_allowed()) ) {
i... |
0ec2b5a6-d0da-4e56-8149-72e6aaa09f07 | 6 | @Override public void removeTabAt(int index) {
// Checks the component type being removed
Component component = getComponentAt(index);
if(component instanceof SourceFileEditor) {
/* SourceFileEditor panels are checked to ensure their SourceFile is
* up to date */
... |
dfdb6a9c-6ebe-4b16-a8c9-642704faaaf0 | 2 | public Boolean getFactAnswerFlag(int id)
{
boolean result= false;
try{
stat.setQueryTimeout(30);
ResultSet rs = stat.executeQuery("SELECT * From Fact Where Id ="+id+";");
result = (rs.getInt("AnswerFlag") == 1) ? true : false ;
}catch(Exception e){
... |
11d549ab-ecbd-4c2e-8b0f-e0d8b402df58 | 1 | public void setWorkingDirectory(File dir) {
if (!dir.exists()) {
throw new IllegalArgumentException(dir + " doesn't exist.");
}
pb.directory(dir);
} |
3b557262-3f78-405d-b1a5-246b7f2e29e7 | 4 | private static void addGeneratedSpeciesToSpeciePool(List<Specie> listOfAllSpecies, SpeciePoolEvolution speciePool) {
if (listOfAllSpecies != null) {
Set<Specie> initialSpeciesSet = speciePool.getSpecieSet();
if (initialSpeciesSet != null) {
for (Specie specie : listOfAllSpecies) {
if (!initialSpeci... |
13d912f5-6c57-4400-9524-0fe1284c6625 | 4 | public long getNewId(ProductList list) throws InvalidIdException {
long id = 1;
long count = 1;
while(id < 999999 && count < list.size()){
if(list.findProductById(id) != null){
id++;
count++;
}
}
if (id < 1000000){
return id;
} else {
throw new InvalidIdException("Id-Limit erreicht!");
... |
4f156196-e566-403d-bb07-9c572909927e | 1 | public String getClassAlias(String className) {
ClassIdentifier classIdent = getClassIdentifier(className);
if (classIdent == null)
return className;
return classIdent.getFullAlias();
} |
b2442a31-d208-450d-a1d6-16ebbf06c399 | 0 | public void smash()
{
} |
5909eef0-ac82-4ba9-9528-5c00a3174015 | 5 | protected void exportClusters() {
String fname = fc.getSelectedFile().getAbsolutePath();
File newFile = new File(fname+".cluster");
fc.setSelectedFile(newFile);
int retval = fc.showSaveDialog(this);
if(retval == JFileChooser.APPROVE_OPTION) {
try {
... |
2261ee3e-dbc3-43e5-9b2e-c69a94607975 | 6 | public Identifier getIdentifier(String fieldName, String typeSig) {
for (Iterator i = getChilds(); i.hasNext();) {
Identifier ident = (Identifier) i.next();
if (ident.getName().equals(fieldName)
&& ident.getType().startsWith(typeSig))
return ident;
}
if (superName != null) {
ClassIdentifier sup... |
63156592-ed0b-46fe-9afb-36d8ba0ba5bc | 9 | @Override
public boolean equals(Object o)
{
if (o == this) return true;
if (o == null) return false;
if (o.getClass() != getClass()) return false;
DbRow other = DbRow.class.cast(o);
return (this.id == other.id)
&& (this.zip == other.zip)
&& (t... |
ef3941b8-2a03-4437-998b-bc181672773b | 1 | public void checkProduction(Production production) {
if (production.getLHS().length() == 0) {
throw new IllegalArgumentException(
"The left hand side cannot be empty.");
}
} |
3acc3c1c-db05-4e6d-875e-339b4dd536f7 | 2 | static void maybeDebugNote(final String message, final boolean force) {
if (DEBUG_ALL || force) {
System.out.println(getTimestamp() + " " + message);
}
} |
fddd2276-9863-4791-aa20-74a28026249c | 3 | @Override
public void run() {
try {
Display.setParent(canvas);
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
}
this.initGL();
this.t = Texture.loadTexture("map1.png");
try {
this.terrain = TerrainLoader.loadTerrain("terrain.png");
} catch (IOException e) {
e.printSta... |
0f2276d5-4892-4077-ae8f-cbd8f3cba74b | 2 | private static double simulateDeck(ArrayList<Card> randDeck, double trials) {
Deck d1 = new Deck();
int turns = 1;
double turnsGlobal = 0;
for (int i = 0; i < trials; i++) {
d1.setCardList((ArrayList<Card>) randDeck.clone());
Player p = new Player(d1);
Game g = new Game(p);
g.init();
... |
97c5c5c2-d880-4d5e-9cbf-3420b34c093d | 8 | public double[] distributionForInstance(Instance instance)
throws Exception {
if (!m_isLeaf) {
// value of split attribute is missing
if (instance.isMissing(m_Attribute)) {
double[] returnedDist = new double[m_ClassProbs.length];
for (int i = 0; i < m_Successors.length; i++) {
double[] help =
... |
d0aa9969-ec66-4303-812a-57043a79a728 | 3 | public void play() {
this.scheduler = plugin.getServer().getScheduler();
Integer[] task = new Integer[3];
Long[] delay = {60L, 80L, 100L};
if(!slot.isEnabled()) {
plugin.sendMessage(player, "This slot machine is currently disabled. Deposit more funds to enable.");
return;
}
// Cost
Double c... |
daf72fdb-5108-4245-a81d-7b7a28601d66 | 5 | public CheckResultMessage checkF05(int day) {
int r1 = get(10, 2);
int c1 = get(11, 2);
int r2 = get(13, 2);
int c2 = get(14, 2);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (0 != getValue(r1 + 4, c1 + day, 2).abs().compare... |
137572b9-b239-4b72-a1c1-23c26e1c761c | 7 | public Tile[][] generateReverseZBlock()
{
Tile[][] piece = new Tile[3][2];
for (int i = 0; i < piece.length; i++)
for (int j = 0; j < piece[i].length; j++)
{
if ((i == 0 && j==1) || (i==1) || (i==2 &&... |
f442a346-d93d-48c4-a0c4-a5419dd79564 | 4 | public List<String> returnAlbums(String bandMid) {
try {
properties.load(new FileInputStream("freebase.properties"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
H... |
d820f701-fb7c-46ed-a291-fc36b7d04431 | 0 | public void setPlayerOneTurn()
{
currentState = States.PlayerOneTurn;
} |
55a3d060-3f94-4a52-8935-2ba837eb1eec | 9 | private void gatherTypes(Set<? extends Element> types)
{
for (Element type : types)
{
if (!ElementKind.CLASS.equals(type.getKind()))
continue;
final PackageElement packageElement = packageOf(type);
final String qName = ((TypeElement)type).getQualifiedName().toString();
if (null == packageElement)
... |
5d7e697b-246e-408b-aff2-1c417a177494 | 6 | public void stop() {
if (isMovingRight() == false && isMovingLeft() == false) {
playerSpeedX = 0;
}
if (isMovingRight() == false && isMovingLeft() == true) {
moveLeft();
}
if (isMovingRight() == true && isMovingLeft() == false) {
moveRight();
}
} |
22fcad6c-ed10-4c47-937c-4f57d9de27d2 | 7 | public void collisionWithPerso(Personnage perso) {
for (Projectile p : liste) {
if (p.getX() < perso.getX1() && p.getX1() > perso.getX() && p.getY() < perso.getY1() &&
p.getY1() > perso.getY() && p.isActive()) {
TYPE t = TYPE.DAMAGE;
if (p.isTrueD... |
7ecb2a69-af80-4225-966d-fc8397aa4b11 | 3 | private static Long getMaxRowProduct(int numbers) {
int max = Integer.MIN_VALUE;
for (int[] row : DATA) {
for (int c = 0; c + numbers < row.length; c++) {
int sum = 1;
for (int offset = 0; offset < numbers; offset++) {
sum *= row[c + offset... |
ebab7e34-30b7-49f9-9b15-a837b820ab58 | 5 | private Image createNoiseImage(final double WIDTH, final double HEIGHT, final Color DARK_COLOR, final Color BRIGHT_COLOR, final double ALPHA_VARIATION_IN_PERCENT) {
int width = WIDTH <= 0 ? (int) PREFERRED_WIDTH : (int) WIDTH;
int height = HEIGHT <= 0 ? (int) PREFERRED_HEIGHT : (int) HEIGHT;
do... |
a1c59b5a-8d47-4de1-b9af-401be190ff74 | 1 | private float numOccurances(int fruit){
float num = 0f;
for (int i = 0; i < occuranceHist[fruit].length; i++){
num += occuranceHist[fruit][i] * i;
}
return num;
} |
c5d461cc-173d-44d3-bcfe-48920911f02c | 4 | public List <String> getIncident(String nodeID){
increaseAccess();
Node node = nodeMap.get(nodeID);
List <String> result = new ArrayList<String>();
if (node != null) {
for(Map.Entry<String, Edge> entrySet : this.edgeMap.entrySet()) {
Edge edge = entrySet.getValue();
if ((edge.getNode1().equal... |
94f96860-827e-4142-9a79-3d273c808fe8 | 3 | public boolean startParsing(final int dId)
{
boolean result = false;
try
{
_logger.debug("Servlet called: " + dId);
new Thread(new Runnable()
{
@Override
public void run()
{
try
{
_logger.debug("Thread started: " + dId);
FileParser fileParser = new FileParser();
i... |
f86d566a-a499-49b8-a5f9-a3472cafeee3 | 2 | static ArrayList createComboSum(int a[]){
ArrayList arr=new ArrayList();
for(int i=0;i<a.length;i++){
for(int j=1;j<(a.length-i);j++){
arr.add(a[i]+a[j]);
}
}
return arr;
} |
457c7967-4730-4dc7-8468-98f1c00e735d | 3 | private void parse_addDefaultCharset( String line,
String keyword,
String[] split,
int lineNumber,
boolean strictMode )
throws ParseException {
// Line has the format:
// "SetHandler" <HandlerName>
if( split.length != 2 ) {
throw new ParseException( "Invalid '"+keyword+"' declarat... |
8b78a9f8-c9c8-4895-98ce-b330e71bb880 | 1 | @Override
public double bonusAttaque(Territoire from, Territoire to) {
if( to.has(SalleInfo.class) )
return 2.0;
return 0.0;
} |
807e3658-1d87-49c1-af09-12cc0e590e0b | 6 | Record(String name, int op, int status) {
if (name == null || name.trim().equals("")) {
throw new IllegalArgumentException("Bad name.");
}
if (op < OP_ADDED || op > OP_MODIFIED) {
throw new IllegalArgumentException("Bad op.");
}
... |
daf48b9c-f695-49a6-9b84-c49606575e0c | 4 | private void addDescendants(TreeNode n, List<TreeNode> children, NodeOrder order) {
if (order == NodeOrder.PREORDER) {
for (TreeNode c : n.getChildren()){
addDescendants(c, children, order);
}
children.add(n);
} else if (order == NodeOrder.POSTORDER)... |
255a578e-134d-4018-b5a8-b3425b49f158 | 6 | @EventHandler
public void WitchWither(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.getWitchConfig().getDouble("Witch.Wither.Dodg... |
3885e023-8d1e-4e91-b923-def541105276 | 0 | public Producto(String nombre, Integer cantidad) {
this.nombre = nombre;
this.cantidad = cantidad;
} |
63f0f843-fd71-4fd0-8ac6-35fe36d9b3d3 | 9 | private void executeWriteRequestOnWriteQuorum(
HashMap<Machine, Boolean> writeStatus,
HashSet<Machine> successfulServers, HashSet<Machine> failedServers,
Article aToWrite) {
/**
* to execute a write on the group of servers we again need to start a
* countDownlatch with writer service
*/
if (faile... |
1aeb02a8-faaa-4178-95bd-6db8f50bc579 | 0 | public void accapt(Visitor visitor) {
visitor.visit(this);
} |
fe7d6bf9-960e-478f-918c-be326c0c04ca | 5 | public static String biomeToString(byte b) {
switch (b) {
case DESERT:
return "Desert";
case SAVANNAH:
return "Savannah";
case SWAMP_RAIN_FOREST:
return "Swamp/Rain Forest";
case MODERATE:
return "Moderate";
case TUNDRA:
return "Tundra";
default:
return "Moderate";
}
} |
043babfe-9721-4f16-88fa-5e6b321cbc8e | 2 | private String clearTitle(String title){
String[] badChars = { "\\","/","\"","<",">","|","*",":","?"};
for (int k = 0;k<badChars.length;k++)
if (title.contains(badChars[k])) {
title = title.replace(badChars[k], "");
}
return title;
} |
cf0e7a4a-9d03-4ef1-93f9-d0963178c460 | 2 | public boolean getKulmankasvatus(Pelihahmo h){
if (h == h1){
return getNappaimenTila(PUORI1);
} else if (h == h2){
return getNappaimenTila(PYORI2);
} else {
return false;
}
} |
07ccf405-338f-4dbd-811f-2687dc4e8ca1 | 0 | public TakeIterator(Iterable<T> source, int take)
{
this._source = source.iterator();
this._take = take;
} |
4248e61d-3b7b-4560-b335-430adcf0613b | 8 | private boolean checkTextFields() {
if(companynameField.getText().length() == 0 || contactField.getText().length() == 0 ||
emailField.getText().length() == 0 || addressField.getText().length() == 0 ||
cityField.getText().length() == 0 || stateField.getText().length() == 0 ||
zipField.getText().length() ==... |
cc7a3205-fba5-4e2e-9e8a-ada4073c0f0e | 4 | public static void main(String[] args) throws Exception {
int maxNorm = Integer.parseInt(args[0]);
maxNorm *= maxNorm;
for(Gaussian e=new Gaussian(3,0); e.norm2()<maxNorm; e=e.inc())
hopp: {
Gaussian f = e;
for(Gaussian z: primes) {
if(f.mod(z).equals(Gaussian.ZERO) && f.norm2() > z.norm2()) {
Sy... |
9ce7ff9d-11f4-4c56-b696-4416439e3033 | 4 | public static String replace(String inString, String oldPattern, String newPattern) {
if (!hasLength(inString) || !hasLength(oldPattern) || newPattern == null) {
return inString;
}
StringBuilder sb = new StringBuilder();
int pos = 0; // our position in the old string
int index = i... |
f65bbe40-bfb8-41f6-9ad7-2d16b7358295 | 3 | protected static boolean areAllCollinear(List<Point> points) {
if(points.size() < 2) {
return true;
}
final Point a = points.get(0);
final Point b = points.get(1);
for(int i = 2; i < points.size(); i++) {
Point c = points.get(i);
if(getTur... |
66691914-0fc5-4838-b589-da2891d7ce30 | 8 | public static int jauEpv00(final double date1, final double date2,
double pvh[][], double pvb[][])
{
/*
* Matrix elements for orienting the analytical model to DE405.
*
* The corresponding Euler angles are:
*
* d ... |
a7f9bb17-fc18-4ebe-bab0-8e349682300b | 7 | private static String stringForJSON(String input) {
if (input == null || input.isEmpty()) return "";
final int len = input.length();
final StringBuilder result = new StringBuilder(len + len / 4);
final StringCharacterIterator iterator = new StringCharacterIterator(input);
char c... |
44a26c2b-2fd3-4d87-a20b-1eb03ff13a98 | 3 | public Builder mergeChatMessage(protocols.ChatProtocol.ChatMessage value) {
if (chatMessageBuilder_ == null) {
if (((bitField0_ & 0x00000002) == 0x00000002) &&
chatMessage_ != protocols.ChatProtocol.ChatMessage.getDefaultInstance()) {
chatMessage_ =
protocols.Ch... |
68ddf02f-4d5f-44c8-9def-a9fec68c63fe | 1 | public EncryptedCommunityCards decyrptEncComCards(
EncryptedCommunityCards cards) throws InvalidKeyException,
IllegalBlockSizeException, BadPaddingException {
EncryptedCommunityCards ret = new EncryptedCommunityCards();
ret.setUserList(cards.getUserList());
for (int i = 0; i < CommunityCards.NUM_CARDS; i... |
f207f339-48fc-4daa-ad52-cf3a73b8452f | 0 | public void setPrpMoaConsec(Integer prpMoaConsec) {
this.prpMoaConsec = prpMoaConsec;
} |
9e2c9fbd-eb2f-4f93-a459-f30c6a3e0609 | 8 | public AppletDescNode(URL codebaseURL, Element node) throws InvalidJNLPException {
if(!node.getNodeName().equals(NAME)) {
String msg = Resources.jnlpBundle.getString("jnlp.xml.bad.element");
throw new InvalidJNLPException(MessageFormat.format(msg, NAME));
}
mainClass = node.ge... |
67be0551-c052-4667-87fb-842ce9a92cb2 | 0 | private void cancel() {
this.shouldProceed = false;
hide();
} |
2cad34b0-117e-4264-a295-55b70e59a17a | 9 | private int fieldSizeOf (Class<?> clazz) {
if (clazz == int.class || clazz == float.class) return 4;
if (clazz == long.class || clazz == double.class) return 8;
if (clazz == byte.class || clazz == boolean.class) return 1;
if (clazz == short.class || clazz == char.class) return 2;
// Everything else is a r... |
f3dc767c-d1d6-4ede-814d-c8ce5b67eabc | 8 | @Override
protected void recieveButtonEvent(int buttonID){
switch(buttonID){
default:
break;
case 1:
Boot.getGUIHandler().addWindow((new DebugGui(-1)));
break;
case 2:
requestPoints(2);
picks = 0;
break;
case 4:
makePrefab();
break;
case 3:
requestPoints(1);
picks = 5;
brea... |
4894d251-9e07-48ed-a638-b6d09c049bf8 | 7 | public void update(Player player) {
if (!isDead()) {
if (hostile) {
Scenery tileToMoveTo = findBestStart(player);
if (tileToMoveTo != null) {
gameMap.applyMove(tileToMoveTo.getX(), tileToMoveTo.getY(), this);
}
gameMap.deleteParents();
} else {
int index... |
7eeb02af-97c8-4a9e-8841-63fc4c8e0b98 | 1 | public boolean EliminarCultivo(Cultivo p){
if (p!=null) {
cx.Eliminar(p);
return true;
}else {
return false;
}
} |
ca874bbb-51f3-4eb9-b85e-563ecedf514d | 8 | private void executeScript() {
Script.clean();
Script.loadScript(cScript.readScriptFile(getScriptFile()));
Iterator<DeviceCommandMessage> it = null;
it = Script.getMessages().iterator();
index = -1;
while (it.hasNext()) {
index++;
DeviceCommandMessage d = it.next();
if (d instanceof KeyCommandM... |
aa1bdc43-1dda-4787-991a-97ce97147984 | 2 | public Map
decodeStream(
BufferedInputStream data )
throws IOException
{
Object res = decodeInputStream(new BDecoderInputStreamStream(data), 0);
if ( res == null ){
throw( new BEncodingException( "BDecoder: zero length file" ));
}else if ( !(res instanceof Map )){
throw( new BEncodingExceptio... |
5292f8b1-258e-4e3b-909a-5df402109c63 | 0 | public Image getImage() {
return anim.getImage();
} |
87108975-a4ea-4725-9b7b-e014f0740983 | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Word word = (Word) o;
if (eWord != null ? !eWord.equals(word.eWord) : word.eWord != null) return false;
if (rWord != null ? !rWord.equals(word.... |
c7aa2519-723d-445f-9948-0c93cb5d8421 | 7 | public String makeMove(String cmd)
{
String tokens[] = cmd.split(" ");
int ambo;
int player;
if(tokens.length != 3)
{
return Errors.INVALID_PARAMS;
}
try
{
ambo = Integer.parseInt(to... |
c22c09c6-0926-44db-89e9-0f5a0b21c86c | 2 | String findGenome(String codonKeyStr) {
for (String genVer : genomeByVersion.keySet()) {
if (codonKeyStr.startsWith(genVer + ".")) return genVer;
}
return null;
} |
49ee93c6-1adc-4b20-911a-f9ae1c7e69da | 9 | public void read(SelectionKey key) throws IOException,
ClassNotFoundException {
loggerNetworkClient.info("READ:");
SocketChannel socketChannel = (SocketChannel) key.channel();
this.rBuffer.clear();
int numRead = 0;
try {
numRead = socketChannel.read(rBuffer);
} catch (Exception e) {
numRea... |
1f82e916-aefd-45c5-9c30-2541e9958e32 | 1 | void openSocket(String hostname, int portNumber, Runnable process) {
try {
socket = new Socket(hostname, portNumber);
process.run();
} catch (IOException e) {
println("Socket could not be open");
} finally {
closeSocket();
}
} |
8df3fed1-251a-4eb2-8a44-704c4f809cf0 | 4 | @Test
public void canRetrieveAColumnFromGrid() {
for (int x = 0, size = sudoku.getGridLength(); x < size; x++)
for (int y = 0; y < size; y++)
sudoku.setCellValue(x, y, x);
int[] column;
for (int i = 0, size = sudoku.getGridLength(); i < size; i++) {
... |
bb7626b8-cbb0-4493-bd44-2d0f4dd2455a | 8 | public void tick() {
tick++;
if (targ == 0 && getGold() >= 600) {
placeTower(new RockTower(this, getTowers().size()));
targ = (int) (4 * Math.random());
} else if (targ == 1 && getGold() >= 800) {
placeTower(new ArrowTower(this, getTowers().size()));
targ = (int) (4 * Math.random());
} else if (targ... |
6ad7f2ed-5d47-42a7-9a3f-26d589514764 | 7 | public static Node goToLineAndColumn(OutlinerDocument doc, int lineNumber, int columnNumber, boolean countDepth, boolean gotoColumn) {
// Get a valid line number
if (lineNumber < 1) {
lineNumber = 1;
}
// Find the nth node.
Node currentNode = doc.tree.getRootNode();
Node nextNode;
for (int i = 0; i < ... |
4f87b62d-85d4-47ec-b952-daa7be08fad2 | 7 | protected boolean validateHeader(byte[] header) {
if (header.length != 16) {
System.err.println("Invalid header. Not 16 bytes???");
return false;
}
// Now we validate the Header based on this document: http://nesdev.parodius.com/neshdr20.txt
// Bytes:
// 0... |
f5f28d18-bbf5-48a3-8c42-6a22fb17852e | 4 | public void visitVarInsn(final int opcode, final int var) {
if (var < 4 && opcode != RET) {
minSize += 1;
maxSize += 1;
} else if (var >= 256) {
minSize += 4;
maxSize += 4;
} else {
minSize += 2;
maxSize += 2;
}
... |
7bba91bf-2a0b-4e4d-83d3-749c436a9b46 | 5 | public void blackAntHill(int temp, int count, int recursive, int length) {
while (recursive < 7) {
if (spaceClear) {
for(int i = 0; i < length; i++) {
world[randRow+count][(i+randCol)+temp].setBAntHill(true);
world[randRow+count][(i+randCol)+temp].setIsAntHill(true);
world[randRow+count][(i+r... |
aa5f614c-c5f8-4f0b-bc94-de2b275a85c2 | 4 | private double[][] assignCosts(SegmentedImage A, SegmentedImage B){
double[][] costs = new double[A.numCells()+3][B.numCells()+3];
double minWeight = 5*100*100;
for(int i = 0; i < A.numCells() + 3; i++){
for(int j = 0; j < B.numCells() + 3; j++){
if (i >= A.numCells() || j >= B.numCells()){
costs[i][j... |
266292d2-4c1c-44b6-bdb4-5e07b0aad3e9 | 9 | public static void printHandValue(int v) {
int masked = 0;
int v0 = (0xF00000 & v) >> 20;
int v1 = (0xF0000 & v) >> 16;
int kicker = 0;
masked = 0xF000000 & v;
if(masked == vmHC) {
v0 = 30-Integer.numberOfLeadingZeros(v&0xFFFF);
System.out.println... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.