method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4dded829-44b5-4243-aa07-aa7a8627e790 | 1 | @Test
public void testDiv_Zero_Exception()
{
try
{
DecimalImpl.valueOf("1").divide(DecimalImpl.ZERO);
Assert.fail("No exception was thrown for divide by 0");
}
catch (Exception e)
{
}
} |
4a6fb699-98fe-494a-97e3-e84a5e70deb9 | 2 | public Book viewBookbyTitle(final String title) {
for (Book book : bookList.getBookList()) {
if (title.equals(book.getTitle())) {
return book;
}
}
return null;
} |
8a51193f-070f-4276-bcd9-30b8ff38b1d9 | 1 | public Position newPosition(Position position) {
if (position == null)
throw new IllegalArgumentException("The given arguments are invalid!");
return new Position(position.xCoordinate + newX, position.yCoordinate + newY);
} |
0a488eaf-492a-4b6b-89da-e0eb41f35ba8 | 4 | public void transform(int id) {
if (vertexSkins == null) {
return;
}
if (id == -1) {
return;
}
Animation animation = Animation.forId(id);
if (animation == null) {
return;
}
SkinList skinList = animation.aSkinList_637;
Model.vertexModX = 0;
Model.vertexModY = 0;
Model.vertexModZ = 0;
for... |
4d1434e5-3159-4682-8141-4e2520f56618 | 5 | private static boolean shouldPrint(EIError.ErrorLevel level) {
boolean ret = false;
if (errorFilterLevel == EIError.ErrorLevel.Notice
|| (errorFilterLevel == EIError.ErrorLevel.Warning && level != EIError.ErrorLevel.Notice)
|| (errorFilterLevel == EIError.ErrorLevel.Error... |
1008bd29-ba27-4f5a-bec7-f8362f776c87 | 7 | @Override
public void update(Observable o, Object arg) {
if (o instanceof Bibliotheque) {
if (arg instanceof Bibliothecaire) {
jLabelStatut.setText("<html><body><font color='green'>Accès autorisé !</font></body></html>");
tableauDeBord = new TableauDeBord();
... |
80a16631-5a84-4541-ac5b-c7fd5e75cf5d | 6 | public static String numberToString(Number number) throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
if (string... |
a01d4ca3-4aeb-4eeb-8209-0e36ad0d722d | 7 | public String tradeFromMarkets() throws MonkeyTalkFailure
{
Application app=new ConnectClass().connect();
String results=null;
try
{
app.tabBar().select("Markets");
app.button("Search").tap();
app.input("_searchField").enterText(cfdMarket, "enter", new Mods.Builder().thinktime(5000).build());
ap... |
78b7b26b-0da3-416f-bf6d-a53e3af0a27e | 2 | private void connect() {
String key = Crawler.extractParameter(Crawler.downloadPage("http://world" + WORLD + ".runescape.com/g=runescape/,j0"), 32);
if (key == null) {
System.err.println("Couldn't find valid handshake key.");
System.exit(1);
}
requester.connect("world" ... |
3e93e6cc-76e5-417b-8fdf-5d977b80a8df | 5 | @Test
public void TestaaAlhaaltaYlosEste() {
rakentaja = new Kartanrakentaja(10, 6);
rakentaja.asetaEste(5, 3);
rakentaja.asetaEste(5, 4);
rakentaja.asetaEste(5, 2);
char[][] kartta = rakentaja.getKartta();
Solmu aloitus = new Solmu(9, 3);
Solmu maali = new So... |
19e6137f-8cac-4681-a8b6-a30ad1726113 | 2 | public void addAndPlay(String songID,String title){
addToQueue (songID,title);
if (player.isPaused()||player.isPlaying())
player.stop();
player.setIndex(model.size()-1);
player.play();
} |
06aacb34-1942-4f1c-9be3-f12bc4c4e44c | 1 | public boolean _setSpriteLabel(String label)
{
if(label != null)
{
this.label = label;
this.setText(label);
return true;
}
else
{
return false;
}
} |
8be280b6-30c2-4a5a-be23-afd4780409bd | 7 | boolean isBasicType() {
return ((type == TYPE_STRING) ||
(type == TYPE_LONG) ||
(type == TYPE_DOUBLE) ||
(type == TYPE_INTEGER) ||
(type == TYPE_LONG_WRAPPER) ||
(type == TYPE_DOUBLE_WRAPPER) ||
(type == TYPE_INTEGER... |
6b1c1aa2-aab6-4729-8a4a-fa709bae353c | 2 | public void setDAO(String daoLine) {
if (daoLine.equals("Mock")) {
dao = new MockDAO();
}
else if (daoLine.equals("MySQL")) {
dao = new MySQLDAO();
}
} |
35554786-be16-455d-884c-765c5e0dc9c7 | 0 | public static void saveImageAsPng(String src, String dest, int formatWidth,
int formatHeight) throws IOException {
File saveFile = new File(dest);
BufferedImage destImage = imageZoomOut(src, formatWidth, formatHeight);
ImageIO.write(destImage, "PNG", saveFile);
} |
877f3173-15b4-406f-89e5-6e24c88f0a81 | 0 | public Player(Animation left, Animation right,
Animation deadLeft, Animation deadRight, Animation standingLeft,
Animation standingRight, Animation jumpingLeft, Animation jumpingRight)
{
super(left, right, deadLeft, deadRight, standingLeft, standingRight, jumpingLeft, jumpingRight);
... |
469d4b6a-6e07-4bdd-b719-36c4229c305c | 1 | public void mouseClicked(MouseEvent e) {
//Запоминаем событие для обработки кнопки
ev = e;
//Получаем выбраную строку в таблице
int selectedRowIndex = tableClients.getSelectedRow();
//Получаем значения
for (int i = 0; i < tableClients.getColumnCoun... |
151b16b4-5c79-4356-b844-0e9d1c451da9 | 2 | public Faculty addFaculty(Map<String, String[]> valuesOfFields, Long id){
Faculty f = new Faculty();
f.setName(valuesOfFields.get("name")[0]);
if (id == null || id <= 0){
dao.addObject(f);
}
else{
f.setId(id);
dao.updateObject(f);
}
... |
bb29b5ff-8a43-40bc-ad8b-4f8725f6ad35 | 6 | public void Solve() {
int count = 0;
for (int x1 = 0; x1 <= _max; x1++) {
for (int y1 = 0; y1 <= _max; y1++) {
for (int x2 = 0; x2 <= _max; x2++) {
for (int y2 = 0; y2 <= _max; y2++) {
if (x1 + y1 + x2 + y2 == 0) {
... |
c5b21cf6-b719-42de-8543-72f0c0dad98c | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
int levelDiff=target.phyStats().level()-(mob.phyStats().level()+(2*getXLEVELLevel(mob)));
if(levelDif... |
2f5d6f1a-9389-444e-9465-76d6cef71fef | 4 | public int getResult() {
int multiplyResult = 2;
do {
if (multiplyResult < addResult) {
increase();
} else {
decrease();
}
multiplyResult = 1;
for (int i = 0; i <= addTwoIndex; i++) {
int number = numbers[i];
log("" + number + "x");
multiplyResult *= number;
}
logln("");
... |
ec553eb8-9d33-4469-aafd-9122674aa850 | 5 | private LinkedHashMap<String,List<String>> ReturnNewRecordWithinBooklist(List<String> bookdate, LinkedHashMap<String,List<String>> borrowlistvalue){
List<String> newbooklist = new ArrayList<String>();
LinkedHashMap<String,List<String>> templinkedHashMap = new LinkedHashMap<String,List<String>>();
templinkedHa... |
d1fe07ef-067b-4712-bf20-34d02e864586 | 5 | public static String formatBytes(long paramLong, boolean MB, boolean GB) {
if (paramLong >= 1000000000L && GB) {
return paramLong / 1000000000L + " GB";
}
if (paramLong >= 10000000L && MB) {
return paramLong / 1000000L + " MB";
}
if (paramLong >= 1000L) {
return paramLong / 1000L + " KB";
}
retur... |
e6957b84-4aad-412f-8463-aa6f427944cf | 5 | private boolean compareParticles(Particle p1, Particle p2) {
if(p1.mass == p2.mass && p1.speedX == p2.speedX && p1.speedY == p2.speedY && p1.x == p2.x && p1.y == p2.y) return true;
return false;
} |
575ba302-5132-4b07-a98a-615621324f4d | 9 | @Override
public String toString() {
StringBuilder sb = new StringBuilder();
if (getMinPasswordLength()>0) sb.append("length>=") .append(getMinPasswordLength()) .append(' ');
if (getMinNumUpperCaseChars()>0) sb.append("upper>=") .append(getMinNumUpperCaseChars()) ... |
1400ee9c-779b-4cbb-8a0c-7c9ea7db7fb8 | 0 | public PDATransitionCreator(AutomatonPane parent) {
super(parent);
} |
c3fa1524-e85b-4258-9d3a-9521b728b248 | 3 | @Override
public void deserialize(Buffer buf) {
livingUID = buf.readInt();
if (livingUID < 0)
throw new RuntimeException("Forbidden value on livingUID = " + livingUID + ", it doesn't respect the following condition : livingUID < 0");
livingPosition = buf.readUByte();
if (... |
08227b86-bc2a-4922-a36c-c90bf8ec7187 | 5 | public void setSourceText(String sourceText) {
if( !sourceText.equals(AlchemyAPI_CombinedParams.CLEANED) && !sourceText.equals(AlchemyAPI_CombinedParams.CLEANED_OR_RAW)
&& !sourceText.equals(AlchemyAPI_CombinedParams.RAW) && !sourceText.equals(AlchemyAPI_CombinedParams.CQUERY)
&& !sourceText.equals(Alchem... |
565b33dc-4603-446a-9ec6-8cb0638bc262 | 9 | public static int getMaxHealth( String race ) {
if ( race.equals("crystal") ) return MAX_HEALTH_CRYSTAL;
else if ( race.equals("engi") ) return MAX_HEALTH_ENGI;
else if ( race.equals("energy") ) return MAX_HEALTH_ENERGY;
else if ( race.equals("human") ) return MAX_HEALTH_HUMAN;
else if ( race.equals("man... |
ec734736-67b0-4bfa-b95a-d2045dbb23fd | 5 | public static void readLines(String file, ArrayList<String> lines) {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(new File(file)));
String line = null;
while ((line = reader.readLine()) != null) {
lines.add(line);
}
} catch (FileNotFoundException e) {
e.pri... |
a014bbe3-6f89-4bcf-beab-8e2561a48d1d | 1 | public void removeEnderecos(Endereco e){
if(enderecos.contains(e)){
enderecos.remove(e);
}
} |
252ee8f0-500e-4fb9-ac8e-974568fe29c0 | 5 | private void addVenueResponses(Choice choice) {
final World world = actor.world() ;
final Batch <Employment> around = new Batch <Employment> () ;
float numSampled = 5 + (actor.traits.traitLevel(INTELLECT) / 4) ;
world.presences.sampleFromKey(
actor, world, (int) numSampled, around, Venue.clas... |
b49ad323-9928-4454-a333-c7eb8705b4e6 | 3 | @SuppressWarnings("static-access")
private void ROUND2() {
enemises.clear();
System.out.println("Round2!!!!!!");
for (int i = 0; i < level.getWidth(); i++) {
for (int j = 0; j < level.getHeight(); j++) {
if ((level.getPixel(i, j) & 0x0000FF) == 2) {
... |
3307434d-5a3e-4ff7-a9f6-b3d5e36b474b | 4 | @Override
public boolean accept(File arg0) {
String fName = arg0.getName();
String ext = "";
if (fName.contains(".")) {
ext = fName.substring(fName.lastIndexOf("."));
}
return ext.equalsIgnoreCase(".png") || ext.equalsIgnoreCase(".jpg") || ext
.equalsIgnoreCase(".bmp") || arg0.isDirectory();
} |
977da55d-cac9-4810-acec-1e852f3888e9 | 0 | @Override
public void documentAdded(DocumentRepositoryEvent e) {} |
f0a699d5-83b1-4ad6-bbb0-77eefdd26609 | 4 | public static void saveAdventurer(Adventurer adventurer) throws IOException {
try {
List<Adventurer> adventurers = new ArrayList<>();
adventurers = getAllAdventurer();
boolean found = false;
for (int i = 0, end = adventurers.size(); i < end; i++) {
... |
2779c331-c454-49d4-a2f9-eb1d6840a8f1 | 9 | protected void do_lblImage_mousePressed(MouseEvent e) {
lastX = e.getX();
lastY = e.getY();
rect = lblImage.getRect();
if (e.getX() >= rect.getX()
&& e.getX() <= rect.getX() + rect.getWidth()
&& e.getY() == rect.getY()) {
drag = true;
}
if ((e.getX() == rect.getX() + rect.getWidth() && e.getY(... |
76aaff59-b83f-4487-9519-57721c9c92f2 | 5 | public JSONObject increment(String key) throws JSONException {
Object value = this.opt(key);
if (value == null) {
this.put(key, 1);
} else if (value instanceof Integer) {
this.put(key, ((Integer) value).intValue() + 1);
} else if (value instanceof Long) {
... |
9c1794e1-09d2-488d-9c96-b20a083b5ff4 | 5 | public Vector get_field_as_vector( String section, String field )
throws NoSuchKeyException, NoSuchSectionException {
Hashtable s;
if(section==null) {
throw new NoSuchSectionException();
}
if(field==null) {
throw new NoSuchKeyException();
}
s = (Hashtable) sections.get(section);
if( s == null) {
thr... |
2d28407e-c94c-41ea-916d-ec7831669405 | 1 | public static void main(String[] args) throws Exception {
String inFile=null;
if(args.length>0)
inFile=args[0];
else
inFile = "default.txt";
InputStream inStream = new FileInputStream(inFile);
LizpLexer lexer = new LizpLexer(new ANTLRFileStream(inFile));
CommonTokenStream tokens = new CommonTokenStr... |
2e1e46c7-4af5-4817-bb42-d7164cdf34f4 | 1 | public void dumpExpression(TabbedPrintWriter writer)
throws java.io.IOException {
/*
* There are special cases where a cast isn't allowed. We must cast to
* the common super type before. In these cases instanceof always return
* false, but we want to decompile even bad programs.
*/
Type superType = i... |
69980bf7-f9e9-437f-96ab-3836e15badf3 | 5 | private void field_cta_nroFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_cta_nroFocusLost
if (lab_modo.getText().equals("Baja") || (lab_modo.getText().equals("Modificación"))){
if (!field_cta_nro.getText().equals("")){
if(existeCta(Integer.parseInt(field_cta_nro.ge... |
d9722d36-a46c-4a4e-acd0-d27313027055 | 0 | protected void interrupted() {
end();
} |
5cc253f8-afce-4f79-a478-9dea431b6921 | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} |
a414c3b1-19cf-4c5f-9cc5-bc37918f9901 | 0 | public static void main(String[] args)
{
List list = new ArrayList();
list.add("String");
list.add(new Integer(1));
list.add(new Boolean(false));
String str = (String)list.get(0);
Integer in = (Integer)list.get(1);
String b = (String)list.get(2);
/**
* Exception in thread "main" java.lang.C... |
405257cf-cd10-4c31-85aa-f5253053736e | 5 | @Override
public void paintComponents(Graphics g) {
Graphics g2 = g.create();
int x, y;
int w, h;
Rectangle bounds = this.parent.getBounds();
if (this.skin.isChanged() || (this.ground == null) || (this.symbol == null)) {
try {
String p = this.ski... |
1d954f2c-2fa4-45c1-9acc-53c005ceca81 | 0 | @Bean
public PlatformTransactionManager transactionManager() {
return new JpaTransactionManager();
} |
512d9fc8-07a5-409b-8c98-273e5c5174c9 | 3 | @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityDamageByEntity(EntityDamageByEntityEvent event)
{
if(Arctica.debug)
{
if(event.getDamager() instanceof Player)
{
if(event.getEntityType() == EntityType.HORSE)
{
... |
10c4d0f7-303d-4a79-9439-3be69ec0a120 | 2 | @Override
public void logicUpdate(GameTime gameTime) {
if (currentState != GameLayerState.PAUSED) {
// Call the start up of any methods that just registered, and add
// them to the logic update list
startUpLogicalQueue(gameTime);
// for (int i = 0, length = gameLogicalQueue.size(); i < length &&
// !... |
da42520b-b79e-488f-9ea5-45011e7178c1 | 1 | public static void main(String[] args) {
try {
AppGameContainer app = new AppGameContainer(new game());
app.setDisplayMode(400, 400, false);
app.setVSync(true);
app.start();
} catch (SlickException e) {
e.printStackTrace();
}
} |
60bc4a05-eabf-4d8d-bae5-3158d59f5e59 | 3 | public int maxIndexLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 30;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
return (optInTimePeriod-1);
} |
7169afb0-132b-40a5-8db8-4d3d4e6123d7 | 5 | public static void modifyDefaultAmounts(List<Account> accountList, Accounts accounts){
if(!accountList.isEmpty()) {
for(Account account : accountList){
BigDecimal defaultAmount = account.getDefaultAmount();
boolean retry = true;
while(retry){
... |
25ecd6e1-d776-458b-8dc1-3baf436ef346 | 4 | public AbstractResource findResource(int resourceId) {
ResourceId id = parseResourceId(resourceId);
for (ResPackage resPackage : this.packages)
if (resPackage.packageId == id.packageId) {
for (ResType resType : resPackage.types)
if (resType.id == id.typeId) {
return resType.getFirstResource(resour... |
d2bc02f2-195c-49b8-aa97-5cf36a295c36 | 3 | public boolean hasVariableAttribute(Element root, String varName, String attributName){
Namespace ns = root.getNamespace();
Element variables = root.getChild("variables", ns);
boolean exists = false;
for (int i=0; i < variables.getChildren().size(); i++){
Element variable = (Element)variables.getChil... |
44f53213-02c7-4825-877c-712dd9194357 | 0 | public String getField() {
return field;
} |
328178a7-0d17-44f7-98e2-3963608fb366 | 7 | private String[] parseURL(
String url
) {
if (url == null) {
return null;
}
String[] parts = new String[8];
// Remove leading and trailing whitespace
url = url.trim();
// Fragment
int fragment_index = url.indexOf(FRAGMENT_DELIM);
if (fragment_index < 0) {
parts[7] = null;
} else {
... |
8beed000-3613-4425-85bc-bbc620f1742b | 4 | @Override
public void caseAVetorVar(AVetorVar node)
{
inAVetorVar(node);
if(node.getColcheteD() != null)
{
node.getColcheteD().apply(this);
}
if(node.getNumeroInt() != null)
{
node.getNumeroInt().apply(this);
}
if(node.getCo... |
ad67ce13-151d-405b-878b-4656d01a95fd | 5 | public static void render() {
//TODO might be laggy
int[] resolution = {Display.getWidth(), Display.getHeight()};
float iconWidth = resolution[1] * 0.05f;
float width = iconWidth * 12f + 13;
float height = iconWidth + 1;
float startX = resolution[0] * x - width * ancho... |
cd8c58f0-5cbb-434c-a8dc-77c4ac85787e | 4 | private void updateCamPos() {
final int marginX = (int) (getWidth() * 0.25);
final int marginTop = (int) (getHeight() * 0.2);
final int marginBottom = (int) (getHeight() * 0.2);
Point pos = hero.getPos();
Dimension dim = hero.getSize();
// update x motion
//... |
3d4d34af-58ea-41c5-94fd-5a760a280b4f | 0 | public void setId(int id) {
this.id = id;
} |
2a57a55b-3a69-4490-846e-b1108d78d004 | 9 | private String[] processCommand(String command) {
String[] words;
if (command.contains("->")) {
words = command.split("->");
commandId = 1;
return words;
} else if (command.contains(" follows ")) {
words = command.split(" follows ");
co... |
c4b6ce2c-9209-4b0f-9f3a-aff0b2fba2c0 | 5 | public boolean isPalindrome(int x) {
if (x < 0)
return false;
if (x == 0)
return true;
int digits = 1;
while (x / digits >= 10)
digits = digits * 10;
while (x > 0) {
if (x / digits != x % 10)
return false;
... |
251736a5-6e30-4bc1-a12f-6aace488082a | 9 | public void removeLayoutComponent(Component comp) {
synchronized (comp.getTreeLock()) {
if (comp == center) {
center = null;
} else if (comp == north) {
north = null;
} else if (comp == south) {
south = null;
} else if (comp == east) {
east = null;
} else if (comp == west) {
west = ... |
c463ce54-5c96-45d9-8927-69f61c87e019 | 7 | public Avatar( AvatarianTranceiver atc, InternalUpdater updater ) {
super(updater);
PatchCable<ObjectEthernetFrame<?>> headPortCable = new PatchCable<ObjectEthernetFrame<?>>(ConnectorTypes.rj45.male, ConnectorTypes.rj45.female, ObjectEthernetFrame.GENERIC_CLASS, 0, updater);
PatchCable<ObjectEthernetFrame<?>> ... |
551a333f-bd05-4e94-b969-cf9142b3b9b2 | 8 | public static Matrix read (BufferedReader input) throws java.io.IOException {
StreamTokenizer tokenizer= new StreamTokenizer(input);
// Although StreamTokenizer will parse numbers, it doesn't recognize
// scientific notation (E or D); however, Double.valueOf does.
// The strategy here is to dis... |
988d53cf-1cab-4314-8957-915755471450 | 3 | @Override
public Livro ListById(int id_livro) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
Livro l = new Livro();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement(LISTBYID);
rs = p... |
fc22a906-d861-49d2-98b5-1fce845839fc | 6 | static Point neighbour(Point p){
Point q = null;
for(int i= p.x-1;i<= p.x+1;i++)
for(int j= p.y-1; j<=p.y+1;j++)
if(map[i][j] == 3 || map[i][j] == 8 || map[i][j] == 0 || map[i][j] == 7)
q= new Point(i,j);
return q;
} |
36e79ec9-89f0-4088-a282-a6c7b79222b7 | 4 | @Override
public void read(Json json, JsonValue val) {
this.ID = val.getString("ID");
this.sceneID = val.getInt("sceneID");
float posX = val.getFloat("posX");
float posY = val.getFloat("posY");
Vector2 pos = new Vector2(posX, posY);
this.setPosition(pos);
this.health = val.getDouble("health");
this.bur... |
72d9a40f-dca5-45aa-a497-1d648147efb1 | 4 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender.hasPermission("CreeperWarning.format")) {
File saveTo = new File(plugin.getDataFolder(), "Warnlog.txt");
boolean b = true;
try {
if (saveTo.exists()) {
saveTo.delete();
}
saveTo.c... |
2b324b29-abdd-460c-9ce6-9cc244c2199e | 1 | private boolean canHaveAsTeleporter(Teleporter teleport) {
if (teleport == null) return false;
return grid.getElementsOnPosition(teleport.getPosition()).isEmpty();
} |
b1bd33d1-3d67-4c5d-8053-b031a49ba463 | 9 | public boolean Validate(kGraph g)
{
for(Iterator< Edge>i = g.edges.iterator();i.hasNext();)
{
Edge edge = i.next();
if( !validEdge(edge, 4, 7, 7)&&
!validEdge(edge,2,8,8) &&
!validEdge(edge, 0, 1, 10) &&
!validEdge(edge, 0 ,5, 11) &&
!validEdge(edge, 1, 8, 12) &&
!validEdge(edge, 1, 6,... |
60800f53-2fcb-49c8-8032-83da0dc6be8e | 5 | public static HashSet<String> wordChecker(String IPString){
IPString = IPString.toUpperCase();
HashSet<String> dictionaryhashset = DictionaryImpl.dictionaryLoader("src/pocket-dic.txt");//le Dictionary
HashSet<String> resultantHS = new HashSet<String>();
int index = 0;
for(String s : dictionaryhashset){
for... |
206cec54-d7ca-4017-85f7-fc968d5b7e15 | 1 | public String getTaggedSentence ( String stringToTag ) {
String result = "";
List<List<HasWord>> sentences = tagger.tokenizeText(new StringReader(stringToTag));
for ( List<HasWord> sentence : sentences ) {
ArrayList<TaggedWord> tSentence = tagger.tagSentence(sentence);
re... |
e1af6af1-410a-4dbe-bc8a-b21fe1240476 | 9 | @Override
public void onUpdate() {
JButton button = mModel.getPressedButton();
Dimension size = button.getSize();
int labelX = mLabel.getX();
int labelY = mLabel.getY();
int buttonX = button.getX();
int buttonY = button.getY();
int buttonPosX = buttonX / size.width;
int buttonPosY = buttonY / size.he... |
50412e59-afe1-434e-a50f-bfb13b537909 | 5 | public int onLoop() throws InterruptedException {
if (canRun) {
if (strategyTask == null && !strategyTask.hasNext())
strategyTask = strategyList.iterator();
else {
final Strategy currentStrat = strategyTask.next();
if (currentStrat != null && currentStrat.canActivate())
currentStrat.execute();
... |
534f7264-31f9-47de-bb11-122470e5b1d2 | 4 | @Override
protected boolean onCache(ByteBuffer buffer)
{
int size = buffer.capacity();
if (!buffer.isDirect() || size < minSize || size > maxSize) {
return false;
}
ByteBufferStack stack = map.get(size);
if (stack == null) {
// Only acquire write lock when adding to map.
synchronized (writeLoc... |
01045f60-fe1c-4a45-b39b-ed173adec337 | 3 | public void setTimers() {
this.timer = new Timer();
if (socketClient != null || (socketClient == null && socketServer == null)) {
this.timer.scheduleAtFixedRate(new MovePlayers(), 0, speed);
this.timer.scheduleAtFixedRate(new Repaint(), 0, speed);
this.timer.scheduleAtFixedRate(new AnimatePlayers(), 0, spe... |
23f0b802-dde6-41c1-9212-6e86ed4e7fd9 | 3 | public static SpeciePoolEvolution readTargetBehavior(String filePath) throws InvalidInputException {
BufferedReader reader = null;
SpeciePoolEvolution speciePoolEvolution = new SpeciePoolEvolution();
try {
reader = new BufferedReader(new FileReader(new File(filePath)));
readConcentrationsAtSpecificTimePoi... |
d47a360d-c0df-48e3-aef7-ebca27f9b0e8 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
HtmlCharToken other = (HtmlCharToken) obj;
if (CHAR != other.CHAR)
return false;
return true;
} |
88e72d4e-2e92-4b1c-a71c-b0798f5b714c | 9 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof ConnectionId) {
ConnectionId that = (ConnectionId) obj;
return isEqual(this.address, that.address)
&& this.maxIdleTime == that.maxIdleTime
&& this.maxRetries == that.maxRetries
&& ... |
84e1d409-ce1a-42fc-b188-692301a43ef1 | 8 | public static Matrix multiplyThread(Matrix matrixA, Matrix matrixB) throws
IllegalSizesException, MatrixIndexOutOfBoundsException {
Matrix matrixC = null;
int rowsA = matrixA.getRowsCount();
int colsA = matrixA.getColsCount();
int rowsB = matrixB.getRowsCount();
int ... |
d7d05246-8144-4cf0-8e68-41eecf226bfe | 3 | public void close()
{
sendMessageToAll(new Message(MessageType.CLOSE));
if(accepter != null)
accepter.close();
if(clients != null)
{
for(Client client: clients)
{
client.close();
}
clients.clear();
}
... |
f26dc2a6-91e6-4637-973a-63562ef7d2fd | 8 | protected void alterneigh(int rad, int i, int b, int g, int r) {
int j, k, lo, hi, a, m;
int[] p;
lo = i - rad;
if (lo < -1)
lo = -1;
hi = i + rad;
if (hi > netsize)
hi = netsize;
j = i + 1;
k = i - 1;
m = 1;
while ((j < hi) || (k > lo)) {
a = radpower[m++];
if (j < hi) {
p = netw... |
cf181bd3-5fca-42dc-9f31-eed80819a779 | 6 | public boolean validarFormato(String vIngreso){
if (vIngreso.isEmpty()){
return true;
}
for(int i = 0; i < vIngreso.length(); i++){
if(!((vIngreso.charAt(i) > 64 && vIngreso.charAt(i) < 91) || (vIngreso.charAt(i) > 96 && vIngreso.charAt(i) < 123))){
... |
031d4dd3-bac0-4b0a-a8d6-6ef17a976e31 | 2 | void parsePI() throws java.lang.Exception
{
String name;
name = readNmtoken(true);
if (!tryRead("?>")) {
requireWhitespace();
parseUntil("?>");
}
if (handler != null) {
handler.processingInstruction(name, dataBufferToString());
}
... |
fc7bf981-f157-4bda-9d1b-7c5f31bc5c71 | 8 | private static void svm_group_classes(svm_problem prob, int[] nr_class_ret, int[][] label_ret, int[][] start_ret, int[][] count_ret, int[] perm)
{
int l = prob.l;
int max_nr_class = 16;
int nr_class = 0;
int[] label = new int[max_nr_class];
int[] count = new int[max_nr_class];
int[] data_label = new int[l]... |
5815f63f-80ac-4a41-922d-6a8bec02cacf | 0 | public HuffmanCountingBloomFilter(final Hashtable<Short,Integer> distribution, final Short[] cbf, final Short maxlen) {
this.huff = new Huffman<Short>(distribution);
this.rate = maxlen;
this.maxlen = maxlen;
this.filter = encodeFilter(cbf);
} |
5eb132bb-2311-43f4-b969-28271be635e8 | 9 | * @param n
* @param module
* @param environment
* @return Stella_Object
*/
public static Stella_Object getNthValue(Stella_Object sequence, int n, Module module, Environment environment) {
if ((n >= PLI.getColumnCount(sequence)) ||
(n < 0)) {
{ OutputStringStream stream000 = OutputStringS... |
64e56930-ad06-4bf7-b63b-0f9acebe7b00 | 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://download.ora... |
e0e69517-8e5c-4735-84f0-67ffe17dc041 | 8 | public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
for(int id = 0; id < shapes.size(); id++)
{
GradientPaint p = null;
if(select+1 == id)
p = new GradientPaint(0,0,Color.GREEN,900,0,Color.BLUE);
else
p = new GradientPaint(0,0,Color.LIGHT_GRAY,80... |
4274fbaa-4fc7-4b6f-bd0e-7ec427e5f616 | 3 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
v = retDoubles(line);
if ((f(v, 0) * f(v, 1)) <= 0... |
88370f48-7a9a-4c36-954c-5549e5e1f704 | 3 | public void SelecionarArquivo(int posicao){
//SELECIONA IMAGEM
int option = fc.showOpenDialog(jPanel1);
if (option == JFileChooser.APPROVE_OPTION) {
separator = System.getProperty("file.separator");
nomePasta = "an... |
3583a813-2680-4425-8250-710b7d2fb37c | 4 | public static void requestProduct() throws IOException {
if (getTextField().getText().length() > 0 && getTextField().getText().matches("[0-9]+")) {
getTextArea().setText(ApiUtil.formatOutput(ApiUtil.fetchObject("products", getTextField().getText())));
ProductApiService.getByNumber(DbReader.getToken(), Long.val... |
cb224a70-b8da-4aba-80d0-c5cbf53fe4c2 | 1 | public void stop(String soundName) {
Sound sound = sounds.get(soundName);
if (sound != null) {
sound.stop();
}
} |
900e0167-d4d9-4fa7-b6a3-52eee77a8d2d | 1 | public Image loadImage (String file) // this method reads and loads the image
{
try
{
InputStream m = this.getClass().getResourceAsStream(file);
return ImageIO.read (m);
}
catch (IOException e)
{
System.out.println ("Error: File " +... |
459bedb8-a45a-41fb-8368-5dd2484328ba | 1 | public int getTicks() {
long i = Ticker.getTime();
if (i - s2 > rate) {
int ticks = (int) ((i - s2) / (long) rate);
s2 += (long) rate * ticks;
return ticks;
}
return 0;
} |
ab8630ff-0e55-4568-b1aa-5ce332855119 | 9 | private void jobJoin(Player play, String job) {
String pLang = PlayerCache.getLang(play.getName());
String jobName = UpperCaseFirst.toUpperFirst(McJobs.getPlugin().getLanguage().getJobNameInLang(job, pLang).toLowerCase());
job = job.toLowerCase();
String sPlay = play.getName();
i... |
66f57532-5bd3-4b66-b875-44f411014202 | 3 | public void update() {
if (resumeGame.contains(MouseMotListener.mouse)) {
hoveringResume = true;
} else {
hoveringResume = false;
}
if (options.contains(MouseMotListener.mouse)) {
hoveringOptions = true;
} else {
hoveringOptions = false;
}
if (exitGame.contains(MouseMotListener.mouse)) {... |
d62b87d6-611e-49b5-8aa3-32d09f92f6ef | 5 | public Vector3f checkCollisions(Vector3f oldPos, Vector3f newPos, float objectWidth, float objectLength)
{
Vector2f collisionVector = new Vector2f(1,1);
Vector3f movementVector = newPos.sub(oldPos);
if(movementVector.length() > 0)
{
Vector2f blockSize = new Vector2f(SPOT_WIDTH, SPOT_LENGTH);
Vector2f ... |
64237965-89e3-42cc-a9fc-ae9aa4746dca | 8 | private void make (String options) {
char action, object = '\0';
int length;
length = options.length();
if (length < 1 || (length < 2 && options.charAt(0) == 'c')) {
System.out.println("Comando inválido.");
return;
}
action = options.charAt(0);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.