method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d23ef957-2c2f-428e-898b-f543e5d28232 | 4 | public int getBaseLevel(int skill) {
int[] skills = ctx.getClient().getSkillBases();
if (skills == null || skills.length == 0 || skill < 0
|| skill >= skills.length) {
return -1;
}
return skills[skill];
} |
33e47fa0-f043-4638-ab3f-1f14ffaaf30c | 8 | @Override
public void removeProperty(String path) {
if (path.startsWith(".")) path = path.substring(1);
// VERY EXPENSIVE
MemoryConfiguration temp = new MemoryConfiguration();
setOptions(temp);
Map<String, Object> values = config.getValues(true);
if (values.containsKey(path)) values.remove(path);
else{
... |
ef9fe5f7-b944-446c-8afe-5b32f94f8fa3 | 7 | public void mouseExited(MouseEvent mouseEvent) {
Iterator<PComponent> it = components.iterator();
while (it.hasNext()) {
PComponent comp = it.next();
if (shouldHandleMouse) {
if (comp.shouldHandleMouse())
comp.mouseExited(mouseEvent);
... |
b227d07d-4503-40cb-ba44-ea7e73d783dd | 6 | public void startNewLevel()
{
spaceReleased = false;
// Create sprite objects
ferdie = new CapnFerdinandLongwhiskers(this, capt, 50, 249);
doggies = new ArrayList<RoyalNavySeadog>();
Random rm = new Random();
for (int i = 0; i < level*5; i++)
{
bo... |
fe4a6575-f9f3-4981-b397-aadd150f7577 | 0 | @Override
public Map<String, Object> extract(RequestAttributes attributes, boolean trace, boolean log) {
System.out.println("extract");
Map<String, Object> map = super.extract(attributes, trace, log);
System.out.println(map);
return map;
} |
f1149eeb-7980-4843-944d-50a809bdbda4 | 7 | public Solution search(State init, int goalN, String strategy, boolean visualize) {
GenericSearch searcher = null;
switch (strategy) {
case "DF":
searcher = new DFSSearch(this, visualize);
break;
case "BF":
searcher = new BFSSearch(this, visualize);
break;
case "ID":
searcher = new IDSearch(thi... |
98cad1c7-a20c-4343-9fe4-e6c61f12d172 | 8 | public void putAll( Map<? extends Integer, ? extends V> map ) {
Iterator<? extends Entry<? extends Integer,? extends V>> it = map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Integer,? extends V> e = it.next();
this.put( e.getKey(), e.getValue() ... |
0e2d691d-caf3-4609-8a0f-e48c586e4f73 | 4 | private void asignarEtiquetasEImagenes() {
_columnasImage.actualizarPregunta("<html>"+_preguntas.get(_posicion).getPregunta()+"</html>");
for (int i = 0; i < _columnaBRevuelta.size(); i++) {
_columnasImage.asignarImagen(_columnaBRevuelta.get(i).getRespuesta(), i);
_columnasImage.... |
6df268d1-b4c7-4870-99f7-705e61e6cb03 | 5 | public void setPower(double power) {
if (power < 0 && getPotValue() >= FULL_FORWARD_POSITION || power > 0 && getPotValue() < FULL_BACKWARD_POSITION || Math.abs(power) < .1) {
power = 0;
}
motor.set(power);
} |
f9888850-1195-43e2-bd54-15647b578030 | 0 | public Layer getLayer() {
return layer;
} |
9232a8a2-adca-41d0-93b7-8a467a185580 | 8 | public String getOption( String op )
{
// TODO: auto, lblAlign, lblOffset
if( op.equals( "crossesAt" ) )
{
return String.valueOf( catCross );
}
if( op.equals( "orientation" ) )
{
return (fReverse) ? "maxMin" : "minMax";
}
if( op.equals( "crosses" ) )
{
if( fMaxCross )
{
return "max";
... |
13ff6ae3-a4ca-4327-9411-5b08f2845274 | 7 | public static void main(String[] args) throws Exception {
System.setProperty("webdriver.chrome.driver", "D:\\Download\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.manage().window().maximize();
File bankNames = new File("E:\... |
3e64b764-f268-422f-b44b-c270bb1399d7 | 5 | private void busqAsuntoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_busqAsuntoActionPerformed
// TODO add your handling code here:
CitaPorAsunto cA = new CitaPorAsunto();
while (cA.extraerAsunto().length()==0 && JOptionPane.showConfirmDialog(this, cA, "Buscar una cita por asunto"... |
2f1291e5-52ae-4ced-b6f7-448bd80554ce | 4 | private void initPilotList() {
try{
RecentLaunchSelections recent = RecentLaunchSelections.getRecentLaunchSelections();
pilotNames = DatabaseUtilities.DatabaseDataObjectUtilities.getPilots();
List<Pilot> recentPilots = recent.getRecentPilot();
for (int i = 0; i < ... |
7db074b9-feec-46e3-b7b2-f73ac856736b | 1 | public long CurrentFilePosition()
{
long position;
try
{
position = file.getFilePointer();
} catch (IOException ioe)
{
position = -1;
}
return position;
} |
7ed677b8-d066-4f05-8882-70b6559ace48 | 9 | @Override
public void run() {
try {
// Eclipse doesn't support System.console()
BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
ConfigManager config = NetBase.theNetBase().config();
try {
ElapsedTime.clear();
String targetIP = config.getProperty("net.server.ip");... |
67e24621-bb6e-42e0-91b4-e3131b949b27 | 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... |
514b8b5f-f9c1-4c78-a40e-34e09409b1aa | 4 | public static void main(String[] args) throws Exception {
List<SeperatorDefinition> seps = new ArrayList<SeperatorDefinition>();
buildCoreSet(Release.ReturnToRavnica, seps);
buildBasicSet(Release.Magic2013, seps);
buildBasicMultiColor(Release.Magic2013, seps);
buildBasic... |
02b58d7b-0bf3-488b-97bf-3b49c9ffe9ef | 1 | public URL getURL() throws MalformedURLException {
URL url = null;
try {
url = new URL(getURLString());
} catch (MalformedURLException mue) {
throw mue;
}
return url;
} |
87c0d266-0997-4f01-a719-711b357c8e78 | 2 | protected void fireEditingStopped()
{
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length - 2; i >= 0; i -= 2)
{
if (listeners[i] == CellEd... |
83bfb985-5951-48cd-8592-6ec5e076571b | 0 | Options(SmallWorld sw, GUICanvas cv, MenuItem mi) {
smallWorld = sw;
menuItem = mi;
canvas = cv;
// Set up layout.
setSize(300,650);
gridBag = new GridBagLayout();
setLayout(gridBag);
c = new GridBagConstraints();
c.anchor = GridBagConstraints.SOUTHWEST;
c.inset... |
7c298642-db6a-4322-bbae-bdd75a74174c | 5 | public void ajouter(Entree e,String s) throws DoubleDeclarationException {
if(listeBloc.get(region_actuelle).containsKey(e) && listeBloc.get(region_actuelle).get(e).getType().equals(s)){
GestionnaireSemantique.getInstance().add(new DoubleDeclarationException(" a la ligne "+e.getLine()+" : "+e.getNom... |
939402d3-677d-43ac-8791-c472b6f6fd0c | 3 | private Decal getFreeDecal() {
long min=Long.MAX_VALUE;
Decal decal=null;
for (int i=0; i<MAX_DECALS; i++) {
if (!decals[i].getVisibility()) {
return decals[i];
}
if (decals[i].getDecalID()<min) {
min=decals[i].getDecalID();
decal=decals[... |
03f965a4-0c01-4f9a-8c86-084ec86bfe65 | 4 | public void selectPreviousRow() {
int rowCount = activityListModel.getRowCount();
if (previousRow >= 0 && rowCount > 0) {
if (rowCount > previousRow) {
tblActivities.getSelectionModel().setSelectionInterval(previousRow, previousRow);
} else if (rowCount == previousRow) {
tblActivities.getSelectionM... |
12f87ec2-d1b9-49d1-9d41-fc996d42a880 | 1 | public boolean matches( Class<?> clazz )
{
return true;
} |
0a413e16-75bf-455c-881e-8976605b4d26 | 5 | public CuttingResult getReward(Tilia x){
int side = x.getSide();
//Check if you have computed this before
if(!tabel.containsKey(side)){
ArrayList<Integer> pieces = new ArrayList<Integer>();
pieces.add(x.getSide());
// First two variables in CuttingResult are not used
... |
e5be0048-6bd9-43cb-a804-579e5fd6d710 | 8 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Card other = (Card) obj;
if (this.value != other.value && (this.value == null || !this.value.equals(other... |
3d488713-b174-4372-86a9-d3c83d7894ac | 2 | void getServer() {
try {
ServerSocket serverSocket=new ServerSocket(9999); //
System.out.println("~");
while(true) {
Socket socket=serverSocket.accept(); //ȴ
new write_Thread(socket).start(); //߳
socketMan.add(socket); //
socketMan.sendClientCount(); //ǰ
}
}catch(Exception e){
e.... |
8dcca00b-e5ee-44e7-b011-457ce97ac6bd | 1 | private void readObject(ObjectInputStream stream) throws java.io.IOException,
java.lang.ClassNotFoundException {
stream.defaultReadObject();
isProperList = stream.readBoolean();
if (!isProperList) {
dottedElement = (E) stream.readObject();
}
} |
9dd52dba-9c14-46cf-81cf-cf5204beaae2 | 9 | private int checkHtml(final StringBuilder out, final String in, int start)
{
final StringBuilder temp = new StringBuilder();
int pos;
// Check for auto links
temp.setLength(0);
pos = Utils.readUntil(temp, in, start + 1, ':', ' ', '>', '\n');
if(pos != -1 && in.charAt... |
51bb9fd1-efa3-4a2b-b028-59f5d28ee530 | 3 | public int somme() {
int s = 0;
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
s += (matrixb[i][j] ? 1 : 0);
}
}
return s;
} |
51133075-63a6-4764-ba68-95b8d9375a8b | 6 | public void setDefaultsForNodeType()
{
CyRow row1, row2;
CyNode node = nodeView.getModel();
double port1EfficiencyVal = 1.0;
int numOfInputsVal = 1;
double timeRampVal = 1.0;
double relativeConcVal = 1.0;
double decayVal = 0.0001;
double initialOutputVal = 0.0;
double intOutputNodeThreshVal = 0.5;
... |
a056692c-984b-4283-9c0b-26769e70ce90 | 9 | public int threeSumClosest(int[] num, int target) {
int record = 0;
int min = Integer.MAX_VALUE;
int length = num.length;
Arrays.sort(num);
for (int i = 0; i < length; i++) {
//except num[0], start is the second number, end is the last number
int start ... |
f0f55730-81af-4d8d-b1fc-4f55f1c359c2 | 7 | public Object invokeConstructor(Reference ref, Object[] params)
throws InterpreterException, InvocationTargetException {
Constructor c;
try {
String[] paramTypeSigs = TypeSignature.getParameterTypes(ref
.getType());
Class clazz = TypeSignature.getClass(ref.getClazz());
Class[] paramTypes = new Clas... |
30561aa9-f3b1-47a7-9743-40b9e8b93372 | 4 | static void insertion_sort(int num[]) {
int number;
for (int i=0;i<num.length-1;i++) {
number=num[i+1];
for(int j=i;j>=0;j--) {
if(number<num[j]) {
num[j+1]=num[j];
num[j]=number;
}
}
}
for (int i:num) {
System.out.println(i);
}
} |
4cea9014-56b2-4fbb-94a6-e84ee30f21cb | 1 | protected String getRightNowTimeStr(final String dateDep, final String secDep, final String dep) {
final String month = (Calendar.getInstance().get(Calendar.MONTH) + 1) > 9 //
? String.valueOf(Calendar.getInstance().get(Calendar.MONTH) + 1) //
: "0" + (Calendar.getInstance().get(Calendar.MONTH) + 1);
return ... |
08cd6631-d7db-42a5-8de3-935abe74e92b | 2 | @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onFoodLevelChange(FoodLevelChangeEvent event) {
Entity entity = event.getEntity();
if (entity instanceof Player) {
xAuthPlayer xp = plyrMngr.getPlayer(((Player) entity).getName());
if (plyrMngr.isRestricted(xp, event))
eve... |
100b7931-8405-4c77-9aa8-d56a8b009207 | 1 | public void setOpenEnded( OpenEndedConnectionStrategy openEnded ) {
if( openEnded == null ){
openEnded = OpenEndedConnectionStrategy.NULL;
}
this.openEnded.endConnecting();
this.openEnded.setParent( null );
this.openEnded = openEnded;
this.openEnded.setParent( site );
} |
95a05177-8b5c-4a6b-b9c6-462281b7289c | 2 | public void createService(String serviceType, String description, String roomNumber) throws ParseException {
//finding roomnumber
int rmNumber = Integer.parseInt(roomNumber);
Query q = em.createQuery("SELECT t from RoomEntity t");
for (Object o : q.getResultList()) {
RoomEnt... |
465ada53-0de6-42e6-98fb-946fd9395905 | 1 | private void addComponents(boolean check) {
this.add(numberOfFilesLabel);
this.add(lineOfCodeLabel);
this.add(commentsLabel);
this.add(blankLinesLabel);
this.add(totalLinesLabel);
if (check) {
this.add(codeShareLabel);
}
} |
0eefed00-e2bb-4877-8955-36206e754e9d | 5 | public UserDetails loadUserByUsername(String username)
throws UsernameNotFoundException {
System.out.println("用户名-------------"+username);
UserLogin userLogin = null;
if(username != null && !"".equals(username)&& username.indexOf("@") > 0){
userLogin = UserLoginDao.findByEmail(... |
5705b99a-ce28-4086-ba92-0ea30e7178ca | 6 | private static final boolean jjCanMove_2(int hiByte, int i1, int i2, long l1, long l2)
{
switch(hiByte)
{
case 0:
return ((jjbitVec4[i2] & l2) != 0L);
case 48:
return ((jjbitVec5[i2] & l2) != 0L);
case 49:
return ((jjbitVec6[i2] & l2) != 0L);
case 51:
re... |
31435b67-c671-4486-b660-9d52fc941218 | 5 | @Override
protected boolean doSmall() {
Tile obeliskRandom;
final GameObject obelisk = ctx.objects.select().id(OBELISK).nearest().poll();
if (obelisk.valid()) {
obeliskRandom = ITile.randomize(obelisk.tile(), 2, 2);
} else {
obeliskRandom = locationAttribute.getObeliskRandom(ctx);
}
if (obeliskRand... |
570ff62b-80cb-49f5-a709-f3eb5889b38e | 0 | public long getThreadUptime() {
return threadUptime;
} |
ee863369-cb70-4cf1-b53f-3670e3f501f8 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
WatchKey other = (WatchKey) obj;
if (folderPath == null) {
if (other.folderPath != null)
return false;
} else if (!folderPath.equals(oth... |
f1acf510-74b8-4f8e-8e24-a326e0ebbcf8 | 9 | public static int[] path(int[] queue) {
int esimene = queue[0];
int[] resultPath = new int[queue.length];
resultPath[0] = esimene;
int i = 0;
int j = 0;
int u = 0;
for (int k : queue) {
if (k < esimene) {
i++;
} else if (k > esimene) {
j++;
} else {
u++;
}
}
int[] vaiksemad =... |
4caa8278-8cdf-406f-b1d6-a3b5d3378f03 | 8 | public void discard(Card card) {
// remove card from hand
if (players[turn].getHand().remove(card)) {
discard.add(card);
sendAll(PacketCreator.discardNotify(card));
} else {
out.println("Discard Error. Card " + card
+ " was not in player's hand.");
System.exit(1);
return;
}
// send foot if... |
20e90af6-9eed-46d7-aaab-868e1e1af4b8 | 8 | public ArticleInfo getArticleInfo(String articleUrl) throws IOException {
String id = getId(articleUrl);
String type = null;
String source = null;
Integer year = null;
Integer month = null;
final HttpRequest request = requestFactory.buildGetRequest(new GenericUrl(articleU... |
74df339b-98a7-45eb-82d4-418671726bd8 | 1 | public static void sort_words(String s) {
String[] words = s.replace(',', ' ').replaceAll("\\s+", " ").split(" ");
Arrays.sort(words);
for (String word : words) {
System.out.println(word);
}
} |
22206d2d-e182-41d4-87ba-0fff5fb23882 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Status other = (Status) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
r... |
947dfe8d-e9e8-4ffa-9532-0f7046c1f68a | 9 | @Override
public void actionPerformed(ActionEvent actionEvent) {
try {
if(actionEvent.getSource() == fileTransferActive) {
if(fileTransferActive.getText().compareTo(FTA_START) == 0) {
iface.startService(ServiceName.FileTransferActive);
fileTr... |
2f287a88-ff21-4e03-be49-584e6a5affd1 | 7 | public EditorToolBar(final BasicGraphEditor editor, int orientation)
{
super(orientation);
setBorder(BorderFactory.createCompoundBorder(BorderFactory
.createEmptyBorder(3, 3, 3, 3), getBorder()));
setFloatable(false);
add(editor.bind("New", new NewAction(),
"/com/mxgraph/examples/swing/images/new.gif"... |
8935ce3d-6ee8-472a-bf8f-ceaa03c93a3b | 9 | public CijferOverzichtPanel() {
setLayout(new BorderLayout(0, 0));
JList list = new JList(vakLijst);
list.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
JList list = (JList) evt.getSource();
if (evt.getClickCount() == 1) {
int index = list.locationToIndex(evt.get... |
cad7ab7b-e1c0-45a2-ae63-7a9332522a03 | 9 | public void actionPerformed(ActionEvent e) {
String[] cmd = e.getActionCommand().split(" ");
switch (cmd[0]) { // lexically listed
case "Accept":
gui.acceptAnswer();
break;
case "Dictionary":
(new Dictionary()).run();
break;
case "Exit":
System.exit(0);
break;
case "Game":
... |
b809cea8-919b-4750-a883-361f0863930d | 3 | private int search(TreeNode root, String query, int d, int length){
if(root == null) return length;
if(root.value != null) length = d;
if(d == query.length()) return length;
char c = query.charAt(d);
return search(root.next[c], query, d + 1, length);
} |
62beed19-0a10-4c98-aa02-6bd194610f8d | 6 | public boolean playSpecialTile(String name, Location loc){
Player p = getPlayer(name);
if(!p.equals(getCurrentPlayer())){
return false;//not your turn!
}
if(!gameBoard.isValidLocation(loc) ||
gameBoard.hasTile(loc) ||
loc.getTile() == null ||
!(loc.getTile() instanceof SpecialTile)){
return fa... |
92fd556f-2e9c-4072-a7e3-22d1ee9f7aca | 2 | private void addInsideCurve(int end, int newRadius) {
if (restricted.isSelected()) {
int sectionBeginning = road.sectionBeginning();
road.addInsideCurve(end, false, newRadius);
if (sectionLongerThanSmax(end, sectionBeginning)) return;
} else {
road.addInsideCurve(end, true, newRadius);
}
} |
4b9451a1-10fe-455e-ad6e-4e3d0440595d | 3 | private void insertRec(TreeNode preNode, TreeNode node) {
if(preNode.val > node.val){
if(preNode.left == null)
preNode.left = node;
else
insertRec(preNode.left,node);
}else{
if(preNode.right == null)
preNode.right = node;
else
insertRec(preNode.right,node);
}
} |
b797c368-515d-4430-a500-6c675368025e | 4 | @Override
public int getMetricInternal() {
int add = EflUtil.runToAddressLimit(0, 0, 10, curGb.pokemon.owPlayerInputCheckAAddress); // after IsSpriteOrSignInFrontOfPlayer call
if(add == 0) {
System.out.println("OverworldInteract: IsSpriteOrSignInFrontOfPlayer call not found");
return 0;
}
int id =... |
8f4850e2-02a6-4d43-b806-87ea23b12136 | 8 | public void paintComponent(Graphics g){
super.paintComponent(g);
this.g=g;
for (int i=0; i<model.getAssociationList().size(); i++){
drawAssociation(i,g);
}
for (int i=0; i<model.objectsListSize(); i++){
int positionX=model.getObjectUmlAtIndex(i).getX();
int positionY=model.getObjectUmlAtI... |
c33c5f48-098e-4d40-a302-54bb6ba8652c | 5 | public void handleEntityDamageByEntity(EntityDamageByEntityEvent e) {
if(!isStarted) {
e.setCancelled(true);
return;
}
Snowball s = (Snowball)e.getDamager();
Player player = (Player)e.getEntity();
Player shooter = (Player)s.getShooter();
World w = ... |
42d28276-bcbe-40bd-9163-364d63070a3a | 7 | private void flattenAppend(Object value) {
if(value==null) return;
if(value instanceof Object[]) {
for( Object o : (Object[])value)
flattenAppend(o);
} else
if(value instanceof Collection<?>) {
for( Object o : (Collection<?>)value)
... |
c0f56f48-3aee-40fd-bded-cf51a99805d7 | 7 | public void start(){
timer.start();
downloadThread = new Thread(new Runnable() {
@Override
public void run() {
BufferedInputStream in = null;
FileOutputStream fout = null;
long downloaded = 0;
for(FileDownloadItem info : items){
try
{
if(!info.getSaveFile().g... |
58ad7fa2-68d6-40a4-abe7-255d18c586cc | 2 | public static double max(double[] vals) {
double max = vals[0];
for (double v : vals) {
if (v > max) {
max = v;
}
}
return max;
} |
ac9c30f5-5baf-47f9-8cb2-84896f95a610 | 8 | public void testClearTarget() {
out.println("clearTarget");
final int MAXEXP = 5;
final int STEPS = 10;
instance = new TabuIndex(MAXEXP);
String[] tgts = new String[MAXEXP];
String[] srcs = new String[MAXEXP];
for (int i = 0; i < MAXEXP; ++i) {
srcs... |
8c2e555d-4aca-4fc0-9d35-5f68b8a87e3f | 1 | @Override
public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
testLevel.Render();
for(int i = 0 ; i < this.fish.size() ; i++) {
this.fish.get(i).render(g);
}
player.render(g);
//GUI
g.setColor(Color.black);
g.drawString(("Fish eaten: " + this.player.ge... |
217018ff-9415-4a60-a84d-d75a52daa92a | 1 | public static String makeSpace( int spaceCount, String word ) {
int i = spaceCount - word.length();
String spaces = " ";
while ( i > 0 ) {
spaces = spaces.concat( " " );
i--;
}
return spaces;
} |
4d1485f7-90ee-42c9-bdfd-1868b3abc360 | 0 | public List<RequestWrapper> getReferRequestWrappers() {
return referRequestWrappers;
} |
43dfa45c-5cb4-44f9-8218-844eeac712f0 | 5 | public String addHost()
{
try {
URL whatismyip = new URL("http://checkip.amazonaws.com/");
BufferedReader in = new BufferedReader(new InputStreamReader(
whatismyip.openStream()));
String ip = in.readLine(); //you get the IP as a String
//System.out.println(ip);
... |
8b0dd886-becd-41cd-a47e-a98d4051b8e3 | 3 | public static void main(String args[]){
File fileForParse = new File("/home/desiresdesigner/ITMO/ИсследоваиеАлгоитмовПартионирования/3 HashMap/4del");
double sum = 0;
double number = 0;
try {
BufferedReader in = new BufferedReader(new FileReader(fileForParse.getAbsoluteFile(... |
b7622c43-2208-49b9-83b6-16c871a45b7c | 6 | public void processCommands() {
try {
if (!commands.isEmpty()) {
while (step == false && index < commands.size()) {
parseLine(commands.get(index));
index++;
}
if (index >= commands.size())
frame.postMessage("Drawing Complete. " +
"No further drawing commands available.\n");
}
... |
6dfc9c97-7d1d-4549-8634-23eaec5cbb6a | 0 | public void setArea(String area) {
Area = area;
} |
01706ac5-ae5e-4ed3-952c-96ab1b59bb2a | 3 | public int inserir(Livro l){
Connection conn = null;
PreparedStatement pstm = null;
int retorno = -1;
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(INSERT, Statement.RETURN_GENERATED_KEYS);
pstm.setString(1, l.getTitulo())... |
447bfb93-d9e2-4058-8f3a-82fe4770ad27 | 4 | private String seekMatchingWords(String keywordWord,
LinkedList<String> word, LinkedList<String> possibleWord) {
for(int j = 0; j < word.size(); j++) {
if(keywordWord.equals(word.get(j))) { return word.get(j); }
}
int shortestDistance = 3;
String wordWithShortestDistance = "";
for(int j = 0; j < poss... |
a3f57447-de65-455a-b339-4e6ae38c3fcb | 3 | public void readTable(Map table) {
Identifier rep = getRepresentative();
if (!rep.wasAliased) {
String newAlias = (String) table.get(getFullName());
if (newAlias != null) {
rep.wasAliased = true;
rep.setAlias(newAlias);
}
}
for (Iterator i = getChilds(); i.hasNext();)
((Identifier) i.next())... |
3ad89a8a-284f-4c11-819c-bb14aaf40ed7 | 4 | public float distance(final float xp, final float yp) {
final float
xd = (xp < xpos) ? (xpos - xp) : ((xp > xmax) ? (xp - xmax) : 0),
yd = (yp < ypos) ? (ypos - yp) : ((yp > ymax) ? (yp - ymax) : 0) ;
return (float) Math.sqrt((xd * xd) + (yd * yd)) ;
} |
0852d03d-71fc-4b2e-a554-69d0edf0510e | 2 | public String readUnicodeString()
throws IOException {
int off = 0;
int len = readInt();
byte[] s = new byte[len];
while (off < len) {
off += read(s, off, len - off);
}
String retval = new String(s,
"UTF-8");
if (trace == API_TRACE_DETAILED) {
debugNote("... |
8ebe76ff-b75a-4acb-abbd-e3c066708f16 | 4 | private boolean smashQuest(Quest q, int id){
if(q.getID() == 5 && q.isStarted()){
if(engine.getPlayer().getBounds().intersects(new Rectangle(320,244,96,96)) && engine.getPlayer().isAttacking())
{
System.out.println("hej");
// conditions is fulfilled
q.setNumberDone(100);
q.updateStatus();
e... |
d7014935-796e-4aa3-b50e-ad5cb7e66f65 | 8 | public static String diceText(int id) {
switch (id) {
case 15086:
return "a six-sided";
case 15088:
return "two six-sided";
case 15090:
return "an eight-sided";
case 15092:
return "a ten-sided";
case 15094:
return "a twelve-sided";
case 15096:
return "a a twenty-sided";
case 15098:
... |
c0bc1258-e4b2-4f6b-90f7-ce6c52634fc8 | 2 | public static User getLatest(Connection con)
{
User user = null;
try
{
ResultSet result = con.createStatement().executeQuery(
"SELECT ID FROM " + tableInfo.tableName + " ORDER BY LastLog DESC { LIMIT 1 }");
result.next();
user = new User(con, result.getString(1));
result.close();
}
catch(S... |
cc2706e5-6427-4cda-9c28-bf2a23fb8d55 | 9 | public static boolean[][] trim( boolean[][] m ){
int minx = m.length;
int miny = m[0].length;
int maxx = 0;
int maxy = 0;
for (int x = 0; x < m.length; x++) {
for (int y = 0; y < m[0].length; y++) {
if( !m[x][y] ){
continue;
}
if( x < minx ) minx = x;
if( y < miny ) miny = y;
if( ... |
19ed4255-2160-42e8-88fb-cb192088dbe3 | 2 | private static List<String> getFieldNameWithListDataType(){
List<String> result = new ArrayList<>();
//CompanyA, refer 1.1
Field[] fields2 = CompanyA.class.getDeclaredFields();
for(Field f : fields2){
// use equals to compare the data type.
if(f.getType().equals(List.class)){
result.add(f.ge... |
f129abb7-088a-4a93-a43e-7692392cc3e7 | 6 | public void checkCollisions() throws SlickException{
// loop all pickables
for (Iterator<Pickable> iterator = pickables.iterator(); iterator.hasNext();) {
Pickable p = iterator.next();
if (p.getBounds().intersects(player.getBounds())) {
if(!p.value.equals("exit")){
level.destroyColors(p.value);... |
a34d3d88-46cc-41ed-a091-81ebd3a5a865 | 0 | public SelectIterable(Iterable<T> source, Selector<T, TResult> selector)
{
this._source = source;
this._selector = selector;
} |
f1ff1c9d-0634-48d5-9475-f27562ea7392 | 8 | public PriorityQueue<Node> makeChildren(){
PriorityQueue<Node> newChildren = new PriorityQueue<Node>();
Person p = currentPeople.get(0);
// System.out.println("*********************Person: " + p.getName());
for(int i = 0; i < data.size(); i++){
if(p.getHeadsGroup() != null || p.getHeadsProject() != n... |
90e3c3a7-311f-47b8-b189-54ebcb51e98f | 1 | public String testStop(String appKey, String userKey, String testId) {
try {
appKey = URLEncoder.encode(appKey, "UTF-8");
userKey = URLEncoder.encode(userKey, "UTF-8");
testId = URLEncoder.encode(testId, "UTF-8");
} catch (UnsupportedEncodingException e) {
... |
bedc02a0-64dc-4e1c-b47f-65051b39463a | 8 | static public byte[] decode(final String base32) {
int i, index, lookup, offset, digit;
byte[] bytes = new byte[base32.length() * 5 / 8];
for (i = 0, index = 0, offset = 0; i < base32.length(); i++) {
lookup = base32.charAt(i) - '0';
/* Skip chars outside the lookup tab... |
b7c5ea46-8d62-4c9e-8731-6a8005b89645 | 4 | public static Reference getReference(String className, String name,
String type) {
int hash = className.hashCode() ^ name.hashCode() ^ type.hashCode();
Iterator iter = unifier.iterateHashCode(hash);
while (iter.hasNext()) {
Reference ref = (Reference) iter.next();
if (ref.clazz.equals(className) && ref.n... |
808e5606-1e1f-4c4d-9293-1618142d73a5 | 8 | public void findMinimumVertexCover()
{
for(int i=1;i<=leftVertices;i++)
{
if(Pair[i]!=0) //Vertices part of matching
{
ArrayList<Integer> adjacencyList = biGraph.getOutEdges(i);
for(int n : adjacencyList)
{
if(rightFreeVertices.contains(n))
{
leftVertexCoverVertices.add(i);
... |
0d06290c-f2dd-4e43-97ec-52dc34c534fb | 1 | public Account(double intitialBalance) {
if (intitialBalance > 0)
balance = intitialBalance;
} |
a2f579b0-eb49-4737-819a-57c25f56e680 | 8 | @SuppressWarnings("unused")
private ArrayList<String> getSimilarLengthResults(String first, int diff) {
// Sanity checks
if (first == null)
return new ArrayList<String>();
if (overkill == null || overkill.isEmpty())
return new ArrayList<String>();
ArrayList<String> sls = new ArrayList<String>();
int s... |
6939bfc9-3b8d-4cbf-adf3-447e1aea09dc | 8 | public void renderColorFont(Image i, int xp, int yp, int tileId, int tileWidth, int color) {
xp -= xOff;
yp -= yOff;
int tw = i.getWidth() / tileWidth;
int xt = tileId % tw;
int yt = tileId / tw;
int tileOffset = xt * tileWidth + yt * tileWidth * i.width;
for (int y = 0; y < tileWidth; y++) {
if ... |
09ed9746-20ef-4d18-9730-cdac051ab320 | 6 | @Override
public boolean execute(RuleExecutorParam param) {
Rule rule = param.getRule();
List<String> values = Util.getValue(param, rule);
if (values == null || values.isEmpty()) {
return false;
}
boolean retValue = true;
for (String value : values) {
String compareValue = rule.getValue();
if (rul... |
8fd4b869-77b0-4bb7-b904-0cde9efea604 | 3 | public boolean contains(int x, int y) {
return x >= 0 && y >= 0 && x < bounds.width && y < bounds.height;
} |
4a38f17f-f09f-42d9-b285-fc3e4aa4d1ac | 4 | @Override
public boolean inputUp(float x, float y) {
if (enabled && visible && getBounds().contains(x, y)) {
if (callback != null)
callback.onButtonEvent(this, DynamicButtonCallback.UP);
return true;
}
return false;
} |
76f13c13-33cc-4ae7-8b14-47e3eebf8474 | 2 | public Sprite getSpriteCollision(Ship ship) {
// run through the list of Sprites
LinkedList <Sprite> sprites = map.getSprites();
for (int i = 0; i < sprites.size(); i++) {
Sprite otherSprite = (Sprite)sprites.get(i);
if (isCollision(ship, otherSprite)) {
... |
5069e43a-2871-4e32-bfa5-0d2d1e561371 | 7 | public static Skolem nthRestComputation(Skolem list, IntegerWrapper narg) {
if (!(Logic.enumeratedListP(list))) {
return (null);
}
{ int n = narg.wrapperValue;
Vector elements = list.definingProposition.arguments;
int nelements = elements.length() - 1;
List restelements = List.newLis... |
6a582a33-bb2a-4fcd-9f88-33991b7f5644 | 6 | static void testInput() {
// otetaan sata ensimmaista, jarjestetaan characterClassin
// mukaan, ja piirretaan iso kuva, josta voi tarkistaa, etta
// samat numeroa esittavat kuvat tulevat perakkain.
Vector<Image> I100 = new Vector<Image>();
for (int i = 0; i < 100; ++i) {
... |
f08437d7-b286-4b9e-ae8a-d290e3fbd187 | 3 | @SuppressWarnings("unchecked")
public boolean removePhoto(String filename, String album) {
if (GuiView.control.getCurrentUser().getAlbumList().get(album).getPhotoList().containsKey(filename)) {
Iterator it = GuiView.control.getCurrentUser().getAlbumList().entrySet().iterator();
while (it.hasNext()) {
M... |
94a61b84-8a67-4b1b-b1b0-97e9ffaba707 | 8 | public static List<ImageBit> cover(ImageBit ib, ImageBit[][] list,
int blockWidth, int blockHeight, BlockType blockType) {
// TODO Auto-generated method stub
int baseX = ib.getX();
int baseY = ib.getY();
List<ImageBit> coverBits = new LinkedList<ImageBit>();
for (int i = 0; i < blockWidth; i++) {
// F... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.