method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9d294487-818d-4d43-bb17-980e10c2807b | 9 | void generateRandomDistributions(int nNodes, int nValues) {
// Reserve space for CPTs
int nMaxParentCardinality = 1;
for (int iAttribute = 0; iAttribute < nNodes; iAttribute++) {
if (m_ParentSets[iAttribute].getCardinalityOfParents() > nMaxParentCardinality) {
nMaxParentCardinality = m_ParentSets[iAttribute].getCardinalityOfParents();
}
}
// Reserve plenty of memory
m_Distributions = new Estimator[m_Instances.numAttributes()][nMaxParentCardinality];
// estimate CPTs
for (int iAttribute = 0; iAttribute < nNodes; iAttribute++) {
int [] nPs = new int [nValues + 1];
nPs[0] = 0;
nPs[nValues] = 1000;
for (int iParent = 0; iParent < m_ParentSets[iAttribute].getCardinalityOfParents(); iParent++) {
// fill array with random nr's
for (int iValue = 1; iValue < nValues; iValue++) {
nPs[iValue] = random.nextInt(1000);
}
// sort
for (int iValue = 1; iValue < nValues; iValue++) {
for (int iValue2 = iValue + 1; iValue2 < nValues; iValue2++) {
if (nPs[iValue2] < nPs[iValue]) {
int h = nPs[iValue2]; nPs[iValue2] = nPs[iValue]; nPs[iValue] = h;
}
}
}
// assign to probability tables
DiscreteEstimatorBayes d = new DiscreteEstimatorBayes(nValues, getEstimator().getAlpha());
for (int iValue = 0; iValue < nValues; iValue++) {
d.addValue(iValue, nPs[iValue + 1] - nPs[iValue]);
}
m_Distributions[iAttribute][iParent] = d;
}
}
} // GenerateRandomDistributions |
00b28307-4041-495e-921c-f19c9d680ebf | 3 | public boolean commitCustomers(Connection conn) throws SQLException {
boolean status = true;
try {
// Start of system transaction
conn.setAutoCommit(false);
BookingMapper bm = new BookingMapper();
status = status && bm.addNewCustomer(newCustomers, conn);
if (!status) {
throw new Exception("Business Transaction aborted");
}
// System transaction ends with success
conn.commit();
} catch (Exception e) {
System.out.println("fail in UnitOfWork - commit()");
System.err.println(e);
// System transaction fails, rollsback
conn.rollback();
status = false;
}
return status;
} |
9b5c147a-b69c-4088-a3e8-3cc756bc0fac | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
RubiksCube other = (RubiksCube) obj;
if (config == null) {
if (other.config != null)
return false;
} else if (!config.equals(other.config))
return false;
if (size != other.size)
return false;
return true;
} |
2af52c54-19cc-4df2-942b-decbc558aaef | 7 | public ConfigurationSection save(ConfigurationSection c){
for(Field f:this.getClass().getFields()){
if(f.isAnnotationPresent(config.class)){
try{
if(f.get(this) instanceof Location){
c.set(f.getName() + ".world", ((Location)f.get(this)).getWorld().getName());
c.set(f.getName() + ".x", ((Location)f.get(this)).getX());
c.set(f.getName() + ".y", ((Location)f.get(this)).getY());
c.set(f.getName() + ".z", ((Location)f.get(this)).getZ());
}else if(f.get(this) instanceof List<?>){
c.set(f.getName(),f.get(this));
}else if(f.get(this) instanceof Configurable){
c.createSection(f.getName());
((Configurable)f.get(this)).applyTo(c.getConfigurationSection(f.getName()));
}else{
c.set(f.getName(), f.get(this));
}
}catch(Exception e){
}
}
}
return c;
} |
19b887d2-49e0-4b78-99fe-7f013a9b0cf4 | 2 | private void renderKingPile(Graphics2D g) {
double x = X_BOARD_OFFSET + CARD_WIDTH + CARD_X_GAP;
double y = Y_BOARD_OFFSET;
g.setColor(Color.white);
g.drawString("King Down", (int) x, (int) y - 1);
for (List<Card> kingPile : game.getKingPiles()) {
if (kingPile.size() > 0) {
renderCard(kingPile.get(kingPile.size() - 1), g, x, y);
}
y += CARD_HEIGHT + CARD_Y_GAP;
}
} |
a075ba95-d99b-4c05-a3c9-917e486b6a3f | 9 | private static void generate() {
for (int i = 0; i < ROW; i++)
Arrays.fill(C[i], -1);
for (int i = 0; i < MAX; i++)
BEST[i] = i;
for (int i = 1; i < COLUMN; i++)
C[0][i] = 1;
for (int i = 1; i < ROW; i++)
C[i][0] = 1;
for (int i = 1; i < ROW; i++)
for (int j = 1; j < COLUMN; j++) {
C[i][j] = C[i-1][j] + C[i][j-1];
if (C[i][j] > MAX) C[i][j] = MAX;
if (C[i][j] > 0 && C[i][j] < MAX) {
BEST[(int) C[i][j]] = Math.min((int) C[i][j], BEST[(int) C[i][j]]);
}
}
} |
4a49ec88-9ded-4eb9-9549-2d62d69f1da2 | 9 | @Override
public TextureRegion getFrame(float stateTime)
{
wait--;
if (x > 800)
x-=1;
if (dying > 0)
{
dying--;
if (dying == 0)
{
this.x = 1100;
this.y = 240;
}
return treeDie.getKeyFrames()[dying / 24];
}
if (firing > 0 && x<=800)
{
rooting = 0;
firing--;
if (firing == 10)
fireAcorn();
return acornFireAnim.getKeyFrames()[firing / 24];
}
if (rooting > 0 && x<=800)
{
firing = 0;
rooting--;
if (rooting == 10)
fireRoot();
return rootFireAnim.getKeyFrames()[rooting / 24];
}
return treeAnim.getKeyFrame(stateTime);
} |
ce8a0331-7751-4bf3-b887-a63884075fb3 | 4 | public static void makeTreeDirected(mxAnalysisGraph aGraph, Object startVertex) throws StructuralException
{
if (isTree(aGraph))
{
mxGraphProperties.setDirected(aGraph.getProperties(), false);
final ArrayList<Object> bFSList = new ArrayList<Object>();
mxGraph graph = aGraph.getGraph();
final mxIGraphModel model = graph.getModel();
Object parent = graph.getDefaultParent();
mxTraversal.bfs(aGraph, startVertex, new mxICellVisitor()
{
@Override
public boolean visit(Object vertex, Object edge)
{
bFSList.add(vertex);
return false;
}
});
for (int i = 0; i < bFSList.size(); i++)
{
Object parentVertex = bFSList.get(i);
Object currEdges[] = aGraph.getEdges(parentVertex, parent, true, true, false, true);
Object[] neighbors = aGraph.getOpposites(currEdges, parentVertex, true, true);
for (int j = 0; j < neighbors.length; j++)
{
Object currVertex = neighbors[j];
int childIndex = bFSList.indexOf(currVertex);
if (childIndex > i)
{
//parentVertex is parent of currVertex, so the edge must be directed from parentVertex to currVertex
// but we need to find the connecting edge first
Object currEdge = getConnectingEdge(aGraph, parentVertex, currVertex);
model.setTerminal(currEdge, parentVertex, true);
model.setTerminal(currEdge, currVertex, false);
}
}
}
mxGraphProperties.setDirected(aGraph.getProperties(), true);
mxGraphStructure.setDefaultGraphStyle(aGraph, false);
}
else
{
throw new StructuralException("The graph is not a tree");
}
}; |
0ced2eb1-dc0a-4a70-bc76-f925d7cdbd5a | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Coordinate other = (Coordinate) obj;
if (coordX != other.coordX)
return false;
if (coordY != other.coordY)
return false;
return true;
} |
1b7bcbb2-c0a8-425f-a49b-d8e47d4e14e9 | 0 | public void start() {
System.out.println("Timer is restarting ...");
startTime = System.currentTimeMillis();
} |
222751d1-15f8-40fc-a0cd-a0759f292fd9 | 7 | public int Run(RenderWindow App){
boolean Running = true;
Text scenario = new Text();
Font Font = new Font();
try {
Font.loadFromFile(Paths.get("rsc/font/mrsmonsterrotal.ttf"));
} catch (IOException e) {
e.printStackTrace();
return (-1);
}
int taille_Font = 27;
scenario.setFont(Font);
scenario.setCharacterSize(taille_Font);
scenario.setString("Bienvenue dans AlektoroZombie !\n" +
"1.Vous pouvez faire pivoter Robert grâce à\n" +
" votre souris.\n" +
"2.Pour lancer des cailloux à nos ennemis jurés \n" +
" appuyez sur le bouton gauche de votre souris.\n" +
"3.Plus les poulets sont proches de la ligne\n" +
" verte plus vous gagnez de points.\n" +
"4.On gagne le maximum de point quand\n" +
" les poulets deviennent verts.\n" +
"5.Attention Robert ne possède que 3 vies.\n" +
"6.Ecoutez bien la musique, elle vous aidera\n" +
" à mieux appréhender les vagues de poulets !\n" +
"7.Bonne chance pour votre guerre\n" +
" contre ces saletés à plumes.\n\n" +
"Appuyez sur une touche pour retouner à l'écran des titres.");
scenario.setPosition( App.getSize().x/2-scenario.getLocalBounds().width/2, 100);
while (Running)
{
//Verifying events
for (Event event : App.pollEvents()) {
{
// Window closed
if (event.type == event.type.CLOSED)
{
return (-1);
}
if(event.type == Event.Type.MOUSE_BUTTON_PRESSED) {
return 1;
}
//Key pressed
if (event.type == Event.Type.KEY_PRESSED)
{
event.asKeyEvent();
if (Keyboard.isKeyPressed(Keyboard.Key.ESCAPE))
return (1);
else
{
return 1;
}
}
}
}
App.draw(scenario);
App.display();
//Clearing screen
App.clear();
}
//Never reaching this point normally, but just in case, exit the application
System.out.println("bootsplash finit");
return (1);
} |
1c64b395-0411-4475-800d-1a8ba331c415 | 0 | public CommandCwformat(CreeperWarningMain plugin) {
this.plugin = plugin;
} |
aeebd04a-f99e-4608-a9aa-2252ad205304 | 4 | public static String GetLoLFolder() {
File file = null;
String path = null;
try {
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setDialogTitle("Please set your Location of \"lol.launcher.exe\"");
chooser.setBackground(Gui.myColor);
chooser.setForeground(Color.LIGHT_GRAY);
chooser.setFileFilter(new FileFilter() {
public boolean accept(File f) {
return f.getName().toLowerCase().endsWith("lol.launcher.exe")
|| f.isDirectory();
}
public String getDescription() {
return "lol.launcher.exe(*.exe)";
}
});
int rueckgabeWert = chooser.showOpenDialog(null);
if (rueckgabeWert == JFileChooser.APPROVE_OPTION) {
file = chooser.getSelectedFile();
if (file.getName().contains("lol.launcher.exe")) {
System.out.println("- Found League of Legends Installation");
path = chooser.getSelectedFile().getParent();
File FilePath = new File("Path");
FileWriter writer;
writer = new FileWriter(FilePath);
writer.write(path);
writer.flush();
writer.close();
} else {
System.out
.println("- No League of Legends Installation found :(");
path = "No installation found";
}
}
} catch (IOException e)
{
logger.error("Write Error");
}
return path;
} |
7c205842-04e3-489e-a039-cb8da7a67242 | 6 | private void copyRGBtoBGRA(ByteBuffer buffer, byte[] curLine) {
if (transPixel != null) {
byte tr = transPixel[1];
byte tg = transPixel[3];
byte tb = transPixel[5];
for (int i = 1, n = curLine.length; i < n; i += 3) {
byte r = curLine[i];
byte g = curLine[i + 1];
byte b = curLine[i + 2];
byte a = (byte) 0xFF;
if (r == tr && g == tg && b == tb) {
a = 0;
}
buffer.put(b).put(g).put(r).put(a);
}
} else {
for (int i = 1, n = curLine.length; i < n; i += 3) {
buffer.put(curLine[i + 2]).put(curLine[i + 1]).put(curLine[i]).put((byte) 0xFF);
}
}
} |
36a47348-0f12-48a4-8049-c34de9a25ac7 | 4 | public void initMethod(State state)
{
try
{
Method[] mets = mod.getClass().getMethods();
for (Method met : mets)
{
if (met.isAnnotationPresent(Initialization.class) && met.getAnnotation(Initialization.class).value() == state)
{
met.invoke(mod);
}
}
}
catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e)
{
e.printStackTrace();
}
} |
0e3928e0-020c-4de4-b22d-b72ba5e93b5d | 6 | public Dictionary parseDictionaryFromFile(File file) throws FileNotFoundException, IOException {
Dictionary lexicon = new Dictionary();
int linenum = 0;
if (file.getName().endsWith("txt")) {
String filename = file.getPath();
lexicon.setFile(file);
Logger.getGlobal().finest("Parsing dictionary file " + file.getName());
FileReader dictionary = new FileReader(filename);
BufferedReader into = new BufferedReader(dictionary);
while (into.ready()) {
try {
String line = into.readLine().trim();
String[] linesplit = line.split(",");
if (linesplit.length > 1) {
if (linesplit[0].trim().length() > 0)
addItemToDictionary(lexicon,linesplit[0].trim(),linesplit[1].trim(),++linenum);
} else {
if (linesplit[0].trim().length() > 0)
addItemToDictionary(lexicon,linesplit[0].trim(),"NONE",++linenum);
}
} catch (Throwable _t) {
Logger.getGlobal().log(
Level.SEVERE, "Error reading dictionary.", _t);
}
}
into.close();
}
Logger.getGlobal().finest("Dictionary has " + lexicon.size() + " terms.");
return lexicon;
} |
64360e85-2d28-4a02-9856-11f48ff5b84b | 1 | public void removeFromParent() {
if (mParent != null) {
mParent.removeChild(this);
}
} |
4eecbed0-246b-4982-8a3a-581e103b367d | 6 | public void GiveExperience(int ammount, Room Room, RoomUser PetUser)
{
Experience += ammount;
ServerMessage Message = new ServerMessage();
Room.Environment.InitPacket(609, Message);
Room.Environment.Append(Id, Message);
Room.Environment.Append(PetUser.VirtualId, Message);
Room.Environment.Append(ammount, Message);
Room.SendMessage(Message);
int c_lev = Level;
while (true)
{
if (Level >= MaxLevel)
{
break;
}
if (Experience > ExperienceLevels[Level])
{
Level++;
}
else
{
if (c_lev < Level)
{
Player Client = Room.Environment.ClientManager.GetClient(OwnerId);
if(Client!=null && (Client.Flags & Server.plrOnline) != Server.plrOnline)
{
// up level
Room.Environment.InitPacket(602, Message);
Room.Environment.Append(PetUser.VirtualId, Message);
Room.Environment.Append(Name, Message);
Room.Environment.Append(Level, Message);
Room.Environment.Append(Type, Message);
Room.Environment.Append(Race, Message);
Room.Environment.Append(Color, Message);
Room.Environment.EndPacket(Client.Connection.Socket, Message);
}
}
break;
}
}
} |
e28d0b56-3163-4aa0-a3c7-e60a79119dcc | 9 | @CLNames(names = { "-abcstat", "-STAT" })
@CLDescription("Old way of adding stats. Deprecated")
public void addStat(String[] statAndConfig) {
String statName = statAndConfig[0];
// turn this into a class in 2 ways. if it contains no . try using this
// package as a prefix
Class type = null;
try {
String packageName = this.getClass().getPackage().getName();
type = Class.forName(packageName + "." + statName);
} catch (ClassNotFoundException e) {
try {
type = Class.forName(statName);
} catch (ClassNotFoundException e1) {
throw new RuntimeException("Could not find ABCStat class " + statName);
}
}
if (!StatsCollector.class.isAssignableFrom(type)) {
throw new RuntimeException("Specified -stat class does not load a ABCStat object but rather a " + type);
}
StatsCollector stat = null;
try {
stat = (StatsCollector) type.newInstance();
} catch (Exception e) {
throw new RuntimeException("Specified -stat class does not have a default constructor", e);
}
if (statAndConfig.length == 1) {
collectionStats.add(stat);
return;
}
try {
CmdLineParser<StatsCollector> parser = new CmdLineParser<StatsCollector>((Class<StatsCollector>) stat.getClass());
if (statAndConfig.length == 2 && statAndConfig[1].contains("help")) {
System.err.println("Help for statCollector:" + statName + "\n" + parser.longUsage());
return;
}
String[] args = new String[statAndConfig.length - 1];
System.arraycopy(statAndConfig, 1, args, 0, args.length);
// System.out.println("StatsARGS:"+Arrays.toString(args));
parser.processArguments(args, stat);
// System.out.println("Object:"+stat+"\t"+parser.longUsage());
} catch (CmdLineBuildException e) {
throw new RuntimeException(statName + " does not take options or we have an error", e);
} catch (CmdLineParseException e) {
throw new RuntimeException("Error With stats options:" + statName, e);
}
collectionStats.add(stat);
} |
dea0a1f0-3d2d-4c07-b19b-6f74ee20fa3f | 4 | private void initializeSlaveMapping() throws BookStoreException {
Properties props = new Properties();
slaveServers = new HashSet<String>();
try {
props.load(new FileInputStream(filePath));
} catch (IOException ex) {
throw new BookStoreException(ex);
}
String slaveAddresses = props.getProperty(BookStoreConstants.KEY_SLAVE);
for (String slave : slaveAddresses
.split(BookStoreConstants.SPLIT_SLAVE_REGEX)) {
if (!slave.toLowerCase().startsWith("http://")) {
slave = new String("http://" + slave);
}
if (!slave.endsWith("/")) {
slave = new String(slave + "/");
}
this.slaveServers.add(slave);
}
} |
493e674d-c833-4695-9abe-0fec6ed58f2e | 2 | public static TicketingFacilityEnumeration fromValue(String v) {
for (TicketingFacilityEnumeration c: TicketingFacilityEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
9ab5f399-023b-4a09-94f0-a3ad2bc0218e | 0 | public ContactIterable(Iterable<T> s1, Iterable<T> s2)
{
this._s1 = s1;
this._s2 = s2;
} |
073c3249-6cab-472c-8c96-ba80a8bf2717 | 6 | void headerOnPaint (Event event) {
CTableColumn[] orderedColumns = getOrderedColumns ();
int numColumns = orderedColumns.length;
GC gc = event.gc;
Rectangle clipping = gc.getClipping ();
int startColumn = -1, endColumn = -1;
if (numColumns > 0) {
startColumn = computeColumnIntersect (clipping.x, 0);
if (startColumn != -1) { /* the clip x is within a column's bounds */
endColumn = computeColumnIntersect (clipping.x + clipping.width, startColumn);
if (endColumn == -1) endColumn = numColumns - 1;
}
} else {
startColumn = endColumn = 0;
}
/* paint the column header shadow that spans the full header width */
Point headerSize = header.getSize ();
headerPaintHShadows (gc, 0, 0, headerSize.x, headerSize.y);
/* if all damage is to the right of the last column then finished */
if (startColumn == -1) return;
/* paint each of the column headers */
if (numColumns == 0) return; /* no headers to paint */
for (int i = startColumn; i <= endColumn; i++) {
headerPaintVShadows (gc, orderedColumns [i].getX (), 0, orderedColumns [i].width, headerSize.y);
orderedColumns [i].paint (gc);
}
} |
b0184e10-b081-43b3-827e-c5e5b381f4e3 | 4 | @Override
public GameState choose(Player player, GameState[] states, Card card) {
for(GameState s : states)
{
s = findSetToTrue(s,card);
}
//If there's only one choice, we have no choice but to do it
if(states.length == 1)
{
return states[0];
}
int alpha = Integer.MIN_VALUE;
int beta = Integer.MAX_VALUE;
GameState choice = null;
//We perform alpha beta search on each state to see if
//it's the best
for(GameState s : states)
{
int check = alphabeta(new GameState(s), alpha, beta,
player.getFaction(), maxDepth);
System.out.println("\ncheck: " + check);
//Check to see if this state is better
if(check > alpha)
{
alpha = check;
choice = s;
}
}
return choice;
} |
74fd6460-82b3-417a-affd-caed2e10f00f | 3 | public void insertNewFact(String name, String text) {
PreparedStatement ps = null;
try{
stat.setQueryTimeout(30);
ResultSet rs = stat.executeQuery("Select * from Fact " +
"where Name = '"+name+"' OR Text ='"+text+"'");
if(!rs.isBeforeFirst())
{
//add new fact to database
String sql = "INSERT INTO Fact (Name, Text, Counter, AnswerFlag, Image) " +
"VALUES ('"+name+"', '"+text+"', 0, 0,'')";
stat.executeUpdate(sql);
}
else
{
stat.setQueryTimeout(30);
//increase counter of the current fact
int Factid = rs.getInt("Id");
int count = rs.getInt("Counter");
if(count != -1)
{
String sql = "UPDATE Fact Set Counter ="+(++count)+" where Id ="+Factid;
stat.execute(sql);
}
}
}catch(Exception e){
System.out.println("insert fact failed");
System.out.println(e.getMessage());
}
} |
e07d404b-22c2-4a19-8c94-5796019ce9e4 | 8 | public static boolean validPalindrome(String s) {
if(s == null) {
return false;
}
int left = 0;
int right = s.length()-1;
while(left < right) {
while(left < right && !Character.isLetterOrDigit(left)){
left ++;
}
while(left < right && !Character.isLetterOrDigit(right)){
right --;
}
if(left < right && s.charAt(left) != s.charAt(right)) {
return false;
}
}
return true;
} |
2d4c7985-9c21-435a-affb-4f444ba869fe | 2 | public long getLong(int index) throws JSONException {
Object object = this.get(index);
try {
return object instanceof Number ? ((Number) object).longValue()
: Long.parseLong((String) object);
} catch (Exception e) {
throw new JSONException("JSONArray[" + index + "] is not a number.");
}
} |
05909ec9-c7b2-468c-bb12-c54b30d937c9 | 6 | public Component getTableCellRendererComponent (JTable table, Object value, boolean selected,
boolean focused, int row, int column) {
super.getTableCellRendererComponent(table, value, selected, focused, row, column);
if (column == 0 || column == 6) { //Weekend rendering.
setBackground (new Color(210, 210, 210));
} else { //Week rendering.
setBackground(new Color(255, 255, 255));
}
if (value != null) {
if (Integer.parseInt(value.toString()) == realDay && currentMonth == realMonth && currentYear == realYear) {
setBackground (new Color(220, 220, 225));
}
}
setBorder(null);
setForeground(Color.black);
return this;
} |
0cb56106-045c-4b35-a73a-5eadd9fe50cf | 0 | public int getPacketTime() {
return lastPacketTime;
} |
59afffc4-a9a3-409e-a139-45f99004b320 | 9 | private void loop(Scanner sc, Server server, ServerNetworkListener listener)
{
String line = sc.nextLine();
if(line.startsWith("/"))
{
String command = line.substring(1);
if(command.equals("stop"))
{
running = false;
server.stop();
BlockyMainServer.console("Server closed");
System.exit(0);
}
else if(command.equals("list"))
{
BlockyClient[] clients = listener.getClients();
BlockyMainServer.console("Player list");
BlockyMainServer.console("============");
for(BlockyClient c : clients)
{
BlockyMainServer.console(c.getName()+"("+c.getID()+") @ "+c.getConnection().getRemoteAddressTCP());
}
BlockyMainServer.console("============");
}
else if(command.startsWith("kick "))
{
String username = command.replace("kick ", "");
String parts[] = username.split(" ");
username = parts[0];
String reason = "Kicked by admin";
try
{
reason = command.substring(6+username.length());
}
catch(Exception e)
{
// e.printStackTrace();
}
BlockyClient[] clients = listener.getClients();
BlockyClient toKick = null;
for(BlockyClient c : clients)
{
if(c.getName().equals(username))
{
toKick = c;
break;
}
}
if(toKick != null)
{
NetworkCommons.sendPacketTo(new PacketKick(reason), false, toKick.getConnection());
toKick.getConnection().close();
BlockyMainServer.console("Player "+toKick.getName()+" has been kicked for: \""+reason+"\"");
}
else
{
BlockyMainServer.console("Player "+username+" doesn't exist.");
}
}
}
else
{
server.sendToAllTCP(new PacketChat("{Server} "+line));
}
} |
5eec5e4d-064c-4c30-a2a0-89559e5d6e8b | 4 | public Element generateElement(Document document)
{
Element key = document.createElement(mxGraphMlConstants.KEY);
if (!keyName.equals(""))
{
key.setAttribute(mxGraphMlConstants.KEY_NAME, keyName);
}
key.setAttribute(mxGraphMlConstants.ID, keyId);
if (!keyName.equals(""))
{
key.setAttribute(mxGraphMlConstants.KEY_FOR, stringForValue(keyFor));
}
if (!keyName.equals(""))
{
key.setAttribute(mxGraphMlConstants.KEY_TYPE, stringTypeValue(keyType));
}
if (!keyName.equals(""))
{
key.setTextContent(keyDefault);
}
return key;
} |
ccc17ac5-0181-405b-a922-873fbab3c8c0 | 2 | public void deposit(BigInteger amount) throws IllegalArgumentException {
if ( (amount == null) || (amount.compareTo(BigInteger.ZERO) <= 0) )
throw new IllegalArgumentException();
setBalance(this.getBalance().add(amount));
} |
62b641eb-6660-41e5-bde0-a6e6b1234eb7 | 2 | private MouseListener mouseListener(){
return new MouseAdapter() {
@Override
public void mousePressed( MouseEvent e ) {
closeMenu();
if( e.isPopupTrigger() ){
popup( e.getX(), e.getY(), e.getComponent() );
}
}
@Override
public void mouseReleased( MouseEvent e ) {
if( e.isPopupTrigger() ){
popup( e.getX(), e.getY(), e.getComponent() );
}
}
};
} |
03f0cea4-9da3-4d6b-99e0-eb906275d787 | 5 | private void checkValuePlacement( String text ) throws RrdException
{
Matcher m = VALUE_PATTERN.matcher(text);
if ( m.find() )
{
normalScale = (text.indexOf(SCALE_MARKER) >= 0);
uniformScale = (text.indexOf(UNIFORM_SCALE_MARKER) >= 0);
if ( normalScale && uniformScale )
throw new RrdException( "Can't specify normal scaling and uniform scaling at the same time." );
String[] group = m.group(1).split("\\.");
strLen = -1;
numDec = 0;
if ( group.length > 1 )
{
if ( group[0].length() > 0 ) {
strLen = Integer.parseInt(group[0]);
numDec = Integer.parseInt(group[1]);
}
else
numDec = Integer.parseInt(group[1]);
}
else
numDec = Integer.parseInt(group[0]);
}
else
throw new RrdException( "Could not find where to place value. No @ placeholder found." );
} |
1e2a6831-951b-44b0-b528-76bc13bd1e79 | 5 | public void paint(Graphics g)
{
if (handles != null && isHandlesVisible())
{
for (int i = 0; i < handles.length; i++)
{
if (isHandleVisible(i)
&& g.hitClip(handles[i].x, handles[i].y,
handles[i].width, handles[i].height))
{
g.setColor(getHandleFillColor(i));
g.fillRect(handles[i].x, handles[i].y, handles[i].width,
handles[i].height);
g.setColor(getHandleBorderColor(i));
g.drawRect(handles[i].x, handles[i].y,
handles[i].width - 1, handles[i].height - 1);
}
}
}
} |
eed1cb9f-c8f4-4c46-9b53-1a43565e96ef | 0 | @Override
public String getName() {
return NAME;
} |
9fa7cf66-3cc4-4725-b8c7-bce0fc25d01e | 1 | private boolean canShootMoreTargets() {
if (attackData.getEnemiesTowerCanShootAtTheSameFrame() > attackData.getEnemiesTowerHasShoot()) {
return true;
}
return false;
} |
b3876cbe-7ade-4ac4-80cf-a4e86506faaf | 5 | public void buttonPress(int function) {
if(function == 1)
{
new EventGUI(myDay,combo.getSelectedIndex(),gui);
gui.reformat();
this.hide();
}
if(function == 2)
{
if(myDay.getEvents().size() != 0)
myDay.getEvents().remove(0);
gui.reformat();
this.hide();
}
if(function == 3)
{
gui.reformat();
this.hide();
}
if(function == 4)
{
new EventGUI(myDay,gui);
gui.reformat();
this.hide();
}
} |
5e6fd39a-51eb-4203-ab51-d256d209dab0 | 1 | @Override
public ArrayList<String> getAllCategories() {
ArrayList<String> categories = new ArrayList<String>();
TypedQuery<Category> categoryQuery = emgr.createNamedQuery("Category.findAll", Category.class);
List<Category> categoriesList = (List<Category>) categoryQuery
.getResultList();
for (int i = 0; i < categoriesList.size(); i++) {
categories.add(categoriesList.get(i).getCategoryName());
}
return categories;
} |
8a6e2a92-b24d-4a43-803f-853b9aa76c4d | 4 | public void attachHost(GridSimCore entity, PacketScheduler sched)
{
String msg = super.get_name() + ".attachHost(): Error - ";
if (entity == null)
{
System.out.println(msg + "the entity is null.");
return;
}
if (sched == null)
{
System.out.println(msg + "the packet scheduler is null.");
return;
}
Link link = entity.getLink();
sched.setBaudRate( link.getBaudRate() );
link.attach(this, entity);
linkTable.put( entity.get_name(), link.get_name() );
if (!schedTable.containsKey( link.get_name() )) {
schedTable.put(link.get_name(), sched);
}
hostTable.put( link.get_name(), entity.get_name() );
// recording ...
if (reportWriter_ != null)
{
StringBuffer sb = null;
sb = new StringBuffer("attach this ROUTER, to entity, ");
sb.append( entity.get_name() );
sb.append(", with packet scheduler, ");
sb.append( sched.getSchedName() );
super.write( sb.toString() );
}
} |
30bb4cbb-a378-41dc-a750-7a3ce2466ffa | 3 | public static Vector3 getVec3fromYamlObject(Object yamlObject)
{
if (!(yamlObject instanceof List))
throw new RuntimeException("yamlObject not a List");
List<?> yamlList = (List<?>)yamlObject;
return new Vector3(
Float.valueOf(yamlList.get(0).toString()),
Float.valueOf(yamlList.get(1).toString()),
Float.valueOf(yamlList.get(2).toString()));
} |
6ff80212-20e9-48ce-a989-dcc7481b4980 | 9 | public void event (ZoneEvent event) {
switch (event.getType()) {
case MOTION:
env.getNotifyService().sendMotion(name);
action(event);
possibleAlarm(event);
break;
case OPENED:
env.getNotifyService().sendDoorOpen(name);
action(event);
possibleAlarm(event);
break;
case CLOSED:
env.getNotifyService().sendDoorClosed(name);
action(event);
break;
case RING:
action(event);
break;
case TEMPERATURE:
scheduleResetTemp();
setTemperature(event.getValue());
break;
case HUMIDITY:
scheduleResetHum();
setHumidity(event.getValue());
break;
case BUTTON:
action(event);
break;
case MOVIE:
action(event);
break;
case COUNT:
// Electricity ping does not cause action
break;
}
} |
90c13a50-660c-4265-bd2a-89c2938a6264 | 3 | public void setSelectionCrossoverOp(String selectedSelectionCrossoverOp) {
try {
Class crossoverClass = Class.forName(selectedSelectionCrossoverOp);
selectionCrossoverOp = (Selection) crossoverClass.newInstance();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
} |
7d69f825-8f94-4e3f-8465-6ccf33220dd4 | 5 | public static byte[] toByteSequence(String data) throws Exception{
/* Counter for making sequence. */
int j=-1;
/* Size of the byte array. */
int byteArrSize = data.length()/8;
/* Checks if the byte array size is adequate. */
if (data.length()%8 != 0)
byteArrSize++;
/* Byte array for output. */
byte[] byteSeq = new byte[byteArrSize];
/* Converts the encoded file to byte code. */
for(int i=0;i< data.length();i++){
if (i%8 == 0){
j++;
byteSeq[j] = 0x00;
}
byte tmp;
if (data.charAt(i) == '1'){
tmp = 0x01;
} else if (data.charAt(i) == '0') {
tmp = 0x00;
} else
throw new Exception ("error in format");
byteSeq[j] = (byte) (tmp | ( byteSeq[j] << 1));
}
return byteSeq;
} |
e38b10b4-44d0-4198-a956-f59ca5ad6140 | 2 | public HaxagonUI() {
Toolkit toolkit = Toolkit.getDefaultToolkit();
Point hotSpot = new Point(0,0);
Image cus = toolkit.getImage(getClass().getResource("Pic/iconse.png"));
//Image curs = toolkit.getImage(getClass().getResource("Pic/Wand.png"));
//Cursor oriCursor = toolkit.createCustomCursor(curs, hotSpot, "wand");
//setCursor(oriCursor);
Cursor GameCursor = toolkit.createCustomCursor(cus, hotSpot, "wand"); //this command is the killer
startButton.setCursor(GameCursor);
aboutButton.setCursor(GameCursor);
exitButton.setCursor(GameCursor);
killBorder(startButton);
killBorder(aboutButton);
killBorder(exitButton);
startButton.setRolloverIcon(startRollOverIcon);
aboutButton.setRolloverIcon(aboutRollOverIcon);
exitButton.setRolloverIcon(exitRollOverIcon);
setSize(800, 600);
createFirstTitle();
setVisible(true);
startButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GameLoopState.effector.openEffect("charge.wav");
try {
UIManager.setLookAndFeel(UIManager
.getSystemLookAndFeelClassName());
} catch (Exception ex) {
ex.printStackTrace();
}
popup = new PopupUI();
popup.setVisible(true);
}
});
aboutButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GameLoopState.effector.openEffect("charge.wav");
JOptionPane
.showMessageDialog(
null,
"Created by \n5430295521 Nontawat Charoenphakdee \n5430297821 Noppayut Sriwatanaksakdi \n5430305121 Nawapat Mahatanarat \n5430376721 Pongsathorn Panyanithisakul \n5430560821 Wichayut Eaksarayut \n5431028521 Park Netrakom \n5431003821 Kawin Worrasangasilpa \n5431019921 Nuttapong Chairatanakul \n5431040021 Sarin Durongdamrongchai \nDepartment of Computer Engineering\nChulalongkorn University\nYear 2557",
"About Us", 1, CP38);
}
});
exitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
GameLoopState.effector.openEffect("charge.wav");
String[] choices = { "Yes", "No" };
int response = JOptionPane.showOptionDialog(null // Center in
// window.
, "Are you sure you want to quit game?" // Message
, "Confirmation" // Title in titlebar
, JOptionPane.YES_NO_OPTION // Option type
, JOptionPane.PLAIN_MESSAGE // messageType
, null // Icon (none)
, choices // Button text as above.
, "None of your business" // Default button's label
);
if (response == 0){
System.exit(0);
}
}
});
} |
20192002-fef5-4a5a-8bf6-edee5a3065fa | 8 | public static void playGame() {
for (Player p : playerList) {
int bet;
System.out.printf("%s, you have $%.2f in your wallet.\n", p.getName(), p.getWallet());
System.out.print("How much do you want to bet? ");
do {
try {
bet = scan.nextInt();
}
catch(InputMismatchException e) {
bet = -1;
}
scan.nextLine();
if (bet < 0)
System.out.print("Invalid input. Please choose a new bet: ");
else if (bet < 1)
System.out.print("Sorry, the minimum bet is $1.00. Please choose a new bet: ");
else if (bet > p.getWallet())
System.out.print("The amount bet exceeds the amount in the wallet. Please choose a new bet: ");
else
p.setBet(bet);
} while (bet < 1 || bet > p.getWallet());
}
dealer.deal(playerList, deck, dealer);
for (Player p : playerList) {
System.out.printf("%s's card is %s.\n", dealer.getName(), dealer.getHand().getCard(0));
playHand(p, p.getHand());
}
dealer.playHand(deck);
} |
4bfafe30-796c-46c0-9639-dc623db176f0 | 8 | private static String escapeJSON(String text) {
StringBuilder builder = new StringBuilder();
builder.append('"');
for (int index = 0; index < text.length(); index++) {
char chr = text.charAt(index);
switch (chr) {
case '"':
case '\\':
builder.append('\\');
builder.append(chr);
break;
case '\b':
builder.append("\\b");
break;
case '\t':
builder.append("\\t");
break;
case '\n':
builder.append("\\n");
break;
case '\r':
builder.append("\\r");
break;
default:
if (chr < ' ') {
String t = "000" + Integer.toHexString(chr);
builder.append("\\u" + t.substring(t.length() - 4));
} else {
builder.append(chr);
}
break;
}
}
builder.append('"');
return builder.toString();
} |
79813941-58d5-4bf5-b424-636b313cca29 | 0 | public void select()
{
listButtons(true);
} |
972f0836-768c-4f80-81e4-e2ec8fcb4c31 | 0 | private String getLabel(Instrument instrument, Calendar calendar) {
String label = instrument.name();
label = label.substring(0, 3) + label.substring(3, 6);
label = label + "_" + df.format(calendar.getTime());
return label;
} |
7264da80-546e-4f92-97cf-e98cc308c2d6 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Person person = (Person) o;
if (favouriteNumber != null ? !favouriteNumber.equals(person.favouriteNumber) : person.favouriteNumber != null)
return false;
if (firstName != null ? !firstName.equals(person.firstName) : person.firstName != null) return false;
if (lastName != null ? !lastName.equals(person.lastName) : person.lastName != null) return false;
return true;
} |
fa9bd6e2-1005-4515-b868-c4cd57301544 | 4 | public Page getPage(TreePath path) {
Object[] way = path.getPath();
PageInfo page = (PageInfo)way[0];
for (int i = 1; i < path.getPathCount(); i++) {
boolean found = false;
for (PageInfo p : page.getSubPages()) {
if (way[i] == p) {
page = p;
found = true;
break;
}
}
if (!found) {
page = null;
break;
}
}
return (Page)page;
} |
fb9abb3e-3f0f-46cc-9047-af2350d27117 | 5 | private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
boolean isValueNumeric = false;
try {
if (value.equals("0") || !value.endsWith("0")) {
Double.parseDouble(value);
isValueNumeric = true;
}
} catch (NumberFormatException e) {
isValueNumeric = false;
}
if (json.charAt(json.length() - 1) != '{') {
json.append(',');
}
json.append(escapeJSON(key));
json.append(':');
if (isValueNumeric) {
json.append(value);
} else {
json.append(escapeJSON(value));
}
} |
883032f9-599f-4815-b93e-bb144605104f | 4 | public void copyPicture(final SimplePicture sourcePicture) {
Pixel sourcePixel = null;
Pixel targetPixel = null;
// loop through the columns
for (int sourceX = 0, targetX = 0; (sourceX < sourcePicture.getWidth())
&& (targetX < this.getWidth()); sourceX++, targetX++) {
// loop through the rows
for (int sourceY = 0, targetY = 0; (sourceY < sourcePicture
.getHeight()) && (targetY < this.getHeight()); sourceY++, targetY++) {
sourcePixel = sourcePicture.getPixel(sourceX, sourceY);
targetPixel = this.getPixel(targetX, targetY);
targetPixel.setColor(sourcePixel.getColor());
}
}
} |
9edfcade-6a27-478f-b179-4a76ef36d196 | 8 | public static void dijkstra(int start) {
int[] distances=new int[p];
boolean[] visited=new boolean[p];
Comparator<vertexButter> vComp = new VertexButterComparator();
PriorityQueue<vertexButter> queue = new PriorityQueue<vertexButter>(p, vComp);
for(int i=0; i<p; i++) {
if(i!=startp[start]) {
distances[i]=MAX;
}
else {
distances[i]=0;
}
queue.add(new vertexButter(i, distances[i]));
}
// run dijkstra
for(int i=0; i<p; i++) {
vertexButter cur=queue.poll();
while(visited[cur.v]) {
cur=queue.poll();
}
visited[cur.v]=true;
ArrayList<vertexButter> updated=new ArrayList<vertexButter>();
for(int j=0; j<adj[cur.v].size(); j++) {
int test=adj[cur.v].get(j);
if(!visited[test]) {
int alt=cur.d+graph[cur.v][test];
if(alt<distances[test]) {
vertexButter newV=new vertexButter(test, alt);
distances[test]=alt;
shortd[start][test]=alt;
updated.add(newV);
}
}
}
for(int j=0; j<updated.size(); j++) {
queue.add(updated.get(j));
}
}
} |
04a0ea49-da1a-4733-9e7e-496a71cb022e | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Exit other = (Exit) obj;
if (!Objects.equals(this.name, other.name)) {
return false;
}
if (!Objects.equals(this.getEx, other.getEx)) {
return false;
}
if (this.exit != other.exit) {
return false;
}
return true;
} |
c03ab745-b528-449d-8944-b0b96ca9f755 | 6 | public boolean equals(Object configuration) {
if (configuration == this)
return true;
try {
if (!super.equals(configuration))
return false;
Tape[] tapes = ((TMConfiguration) configuration).myTapes;
if (tapes.length != myTapes.length)
return false;
for (int i = 0; i < tapes.length; i++)
if (!tapes[i].equals(myTapes[i]))
return false;
return true;
} catch (ClassCastException e) {
return false;
}
} |
15a81147-cd87-45aa-b2e4-2c41d9609d90 | 2 | public PreparedStatement build(Connection connection) throws SQLException {
if (this.sqlCache == null) {
this.sqlCache = builder.toString();
}
PreparedStatement preparedStatement = connection.prepareStatement(sqlCache);
for(int i = 0; i != parameters.size(); ++i) {
preparedStatement.setObject(i + 1, parameters.get(i));
}
return preparedStatement;
} |
b2c7fc32-282b-4903-a342-1a5ccccf5c3d | 8 | public Case(int a, int x, int y){
setSize("54px", "54px");
if (a == 1) { setStyleName("caseSol"); }
else if (a == 2) { add(new SiegeButton("images/siege2.png",x,y,false)); }
else if (a == 3) { add(new DecoButton("/images/table2.png")); }
else if (a == 4) { add(new CafeButton()); }
else if (a == 5) { add(new SortieButton()); }
else if (a == 6) { add(new DecoButton("/images/plante2.png")); }
else if (a == 7) { add(new DecoButton("/images/lampe1.png")); }
else if (a == 8) { add(new SiegeButtonModo("/images/siege2_modo.png", x, y, false)); }
} |
520d561d-69d3-4cce-a810-82b746819b98 | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
if (c < ' ') {
throw syntaxError("Unterminated string.");
}
if (c == q) {
return sb.toString();
}
sb.append(c);
}
}
for (;;) {
if (c == 0 || Character.isWhitespace(c)) {
return sb.toString();
}
sb.append(c);
c = next();
}
} |
24ef4339-8545-4e9c-8e56-8904520d5252 | 2 | public static byte[] executeFunction(byte[] block, byte[] subkey) throws IllegalArgumentException {
if (block.length != 4)
throw new IllegalArgumentException("Block should be 4 bytes long.");
else if (subkey.length != 6)
throw new IllegalArgumentException("Key should be 6 bytes long.");
// Send data through expansion table
byte[] transmutedBlock = ByteHelper.permutFunc(block, Feistel.expansionTabel42Bits);
// xor data with subkey
byte[] xoredBytes = ByteHelper.xorByteBlocks(transmutedBlock, subkey);
// execute S function on data
byte[] result = executeS(xoredBytes);
// send data through permutation table
byte[] feistelResult = ByteHelper.permutFunc(result, Feistel.permutatieTabel32Bits);
return feistelResult;
} |
2f733bbd-0078-405f-966d-88e3ba251b48 | 3 | public int lookup(PageId pageNo) {
// Instantiate a new entry
BufHTEntry entry;
int index;
// If the page does not exist return an INVALID_PAGE
if (pageNo.pid == INVALID_PAGE)
return INVALID_PAGE;
// Determine which bucket in Page Table array that the pageNo would be in
index = hash(pageNo);
// Iterate through Page Table linked list searching for the pageNo specified
// If found, return index in array, else return an INVALID_PAGE
for (entry = ht[index]; entry != null; entry = entry.next) {
if (entry.pageNo.pid == pageNo.pid) {
return(entry.frameNo);
}
}
// pageNo was not in the Page Table
return(INVALID_PAGE);
} // end lookup() |
fc8c4f86-a3ba-4087-8ad5-7261cc86bb37 | 1 | public boolean hasRoute(Node to)
{
if (dij != null)
{
return dij.hasPathTo(to);
}
return false;
} |
95ec16ef-cf18-4140-bf94-0f71607582be | 7 | private Content retrieveInheritedDocumentation(TagletWriter writer,
ProgramElementDoc ped, Tag holderTag, boolean isFirstSentence) {
Content replacement = writer.getOutputInstance();
Configuration configuration = writer.configuration();
Taglet inheritableTaglet = holderTag == null ?
null : configuration.tagletManager.getTaglet(holderTag.name());
if (inheritableTaglet != null &&
!(inheritableTaglet instanceof InheritableTaglet)) {
String message = ped.name() +
((ped instanceof ExecutableMemberDoc)
? ((ExecutableMemberDoc)ped).flatSignature()
: "");
//This tag does not support inheritence.
configuration.message.warning(ped.position(),
"doclet.noInheritedDoc", message);
}
DocFinder.Output inheritedDoc =
DocFinder.search(new DocFinder.Input(ped,
(InheritableTaglet) inheritableTaglet, holderTag,
isFirstSentence, true));
if (inheritedDoc.isValidInheritDocTag) {
if (inheritedDoc.inlineTags.length > 0) {
replacement = writer.commentTagsToOutput(inheritedDoc.holderTag,
inheritedDoc.holder, inheritedDoc.inlineTags, isFirstSentence);
}
} else {
String message = ped.name() +
((ped instanceof ExecutableMemberDoc)
? ((ExecutableMemberDoc)ped).flatSignature()
: "");
configuration.message.warning(ped.position(),
"doclet.noInheritedDoc", message);
}
return replacement;
} |
b2712493-2133-40c6-88ab-4c671f8af6e5 | 0 | public Wall(int x,int y)
{
super(x,y);
URL loc = this.getClass().getResource("/karel/themes/LTTPWall.png");
ImageIcon iia = new ImageIcon(loc);
image = iia.getImage();
this.setImage(image);
} |
2fa8f008-b373-4f1d-8669-683ca0b87c94 | 1 | @Override
public void deleteAndCopyHistory(MediaUrlModel mediaUrlModel) {
try {
String query = "INSERT INTO " + TABLE_HISTORY_NAME;
query += " (original_id, url,search_word,twitter_user_name, created_at,updated_at) VALUES (?,?,?,?,?,?) ";
PreparedStatement stmt = con.prepareStatement(query);
stmt.setInt(1, mediaUrlModel.getId());
stmt.setString(2, mediaUrlModel.getUrl());
stmt.setString(3, mediaUrlModel.getSearch_word());
stmt.setString(4, mediaUrlModel.getTwitter_user_name());
stmt.setString(5, Calender.nowString());
stmt.setString(6, Calender.nowString());
stmt.executeUpdate();
stmt.close();
// 削除
PreparedStatement stmt2 = con.prepareStatement("DELETE FROM "
+ TABLE_NAME + " WHERE url ='" + mediaUrlModel.getUrl()
+ "';");
stmt2.executeUpdate();
stmt2.close();
} catch (SQLException e) {
e.printStackTrace();
}
} |
d5ecb353-b614-46ca-9e1c-265507241266 | 0 | public PlatformCompatibility() {} |
7328f6dc-8b19-4d22-aa8e-5fc971bd8a1c | 4 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(args.length == 0) {
return noArgs(sender, command, label);
} else {
final String subcmd = args[0].toLowerCase();
// Check known handlers first and pass to them
final CommandHandler handler = registeredHandlers.get(subcmd);
if(handler != null) {
return handler.onCommand(sender, command, label, shortenArgs(args));
}
// Its our command, so handle it if its registered.
final BadgeCommand subCommand = registeredCommands.get(subcmd);
if(subCommand == null) {
return unknownCommand(sender, command, label, args);
}
// Execute command
boolean value = true;
try {
value = subCommand.execute(plugin, sender, command, label, shortenArgs(args));
} catch(ArrayIndexOutOfBoundsException e) {
sender.sendMessage(ChatColor.GRAY + Badges.TAG + ChatColor.RED + " Missing parameters.");
}
return value;
}
} |
5fdf7add-7a3e-47e4-9c2b-2579bb773ceb | 5 | public static void main(String [] args){
boolean found=false;
int [] values={1,5,11,25,9,3};
Arrays.sort(values);
int low=0;
int high=values.length-1;
int pos=0;
int searchedNumber=11;
while(low<=high&&!found){
pos=(low + high)/2;
if(values[pos]>searchedNumber){
high=pos-1;
}
else if(values[pos]<searchedNumber){
low=pos+1;
}
else{
found=true;
}
}
if(found) {
System.out.println("Found at position: "+ pos);
}
else{
System.out.println("Not found. Insert before position "+ pos);
}
} |
f9b3c06e-0436-4700-bcbb-3fb234831abc | 6 | public void supprimer(int debut, int fin) {
if (debut == fin && debut > 0) {
contenu.deleteCharAt(debut - 1);
position = debut - 1;
} else if (debut == fin) {
if (debut > 0) {
contenu.deleteCharAt(debut);
position = debut;
}
} else if (debut >= 0 && fin >= 0) {
contenu.delete(debut, fin);
position = debut;
}
notifier();
} |
70772c59-bb57-4cad-b988-7b1ae3b47770 | 8 | private void processMessage(String message)
{
if (message.equals(TOOLKIT_SETTINGS_REQUEST))
{
sendToolkitSettings();
}
else if (message.startsWith("<toolkit"))
{
processToolkitSettings(message);
}
else if (remoteToolkitSettings == null)
{
sendCommand(TOOLKIT_SETTINGS_REQUEST);
}
else if (message.equals(CHALLENGE_REQUEST))
{
// partner is requesting a challenge
networkSubState = BaseStateEnum.Network_Make_A_Challenge;
}
else if (message.equals(HELP_REQUEST))
{
// partner is asking for help - ACCEPT THE CHALLENGE
networkSubState = BaseStateEnum.Network_Help;
}
else if (message.equals(SAVE_REQUEST))
{
if (BaseStateEnum.Network_Take_A_Challenge.equals(networkSubState))
{
// partner has made a challenge for you to solve
networkSubState = BaseStateEnum.Network_Solve;
}
else
{
// partner is saving a solution
networkSubState = BaseStateEnum.Network_Try;
}
}
else if (message.startsWith("<event"))
{
processEvent(message);
}
} |
d0506ea9-9d1e-4ee4-9c60-e6a3fe8e07b2 | 1 | @Test
public void WhenStaticUnionCollections_ExpectResultUnion()
throws UnknownHostException {
ArrayList<Host> list0 = new ArrayList<Host>(1);
Host host0 = new PGridHost("127.0.0.1", 3333);
list0.add(host0);
ArrayList<Host> list1 = new ArrayList<Host>(1);
Host host1 = new PGridHost("127.0.0.1", 1111);
list1.add(host1);
Collection<Host> result = RoutingTable.union(list0, list1);
Assert.assertTrue(result.size() == 2);
Assert.assertTrue(result.contains(host0) && result.contains(host1));
} |
83605089-4483-43c6-87a4-54ea97ad80aa | 0 | @Override
public void onDisable() {
} |
0ed600b1-9eba-4b10-b23c-779c9f3b6aa7 | 0 | public int size() {
return myCards.size();
} |
a00e1f87-57c0-47f6-ab8b-227ee589c52e | 9 | public static boolean isObjectIdValid(String s) {
if (s == null)
return false;
final int len = s.length();
if (len != 24)
return false;
for (int i = 0; i < len; i++) {
char c = s.charAt(i);
if (c >= '0' && c <= '9')
continue;
if (c >= 'a' && c <= 'f')
continue;
if (c >= 'A' && c <= 'F')
continue;
return false;
}
return true;
} |
3d375dcc-72ac-4427-8add-34a5f623d4b6 | 9 | public Map<String, String> downloadTaskContext(TaskAttribute attribute)
throws TaskContextDownloadException {
// filepath, submitter
Map<String, String> taskContextMap = new HashMap<>();
// check if the directory to download all task contexts is existing
File f = new File("MylynContexts");
if (!f.exists()) {
System.out.println(f.getAbsolutePath());
boolean isCreated = f.mkdir();
if (isCreated == false) {
throw new TaskContextDownloadException();
}
}
Map<String, TaskAttribute> attrs = attribute.getAttributes();
int counter = 0;
for (Map.Entry<String, TaskAttribute> entry : attrs.entrySet()) {
if (entry.getKey().contains("task.common.attachment")) {
TaskAttribute attachmentAttr = entry.getValue();
TaskAttribute descAttr = attachmentAttr.getAttribute("desc");
String attchFileName = descAttr.getValue();
if (attchFileName.equals("mylyn/context/zip")) {
// check if the directory to download these task contexts is
// existing
File tcDir = new File("MylynContexts/"
+ attribute.getTaskData().getTaskId());
if (!tcDir.exists()) {
System.out.println(tcDir.getAbsolutePath());
boolean isCreated = tcDir.mkdir();
if (isCreated == false) {
throw new TaskContextDownloadException();
}
}
String tcName = tcDir.getPath() + "\\"
+ attribute.getTaskData().getTaskId() + "_"
+ counter + ".zip";
TaskAttribute urlAttr = attachmentAttr
.getAttribute("task.common.attachment.url");
String submitter = attachmentAttr.getAttribute(
TaskAttribute.ATTACHMENT_AUTHOR).getValue();
try {
String urlString = urlAttr.getValue();
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
InputStream in = conn.getInputStream();
FileOutputStream out = new FileOutputStream(tcName);
byte[] b = new byte[1024];
int count;
while ((count = in.read(b)) >= 0) {
out.write(b, 0, count);
}
out.flush();
out.close();
in.close();
} catch (IOException e) {
e.printStackTrace();
}
taskContextMap.put(tcName, submitter);
counter++;
}
}
}
return taskContextMap;
} |
3cc3eeba-31f4-4578-a463-dd0ed0f56f85 | 0 | @AfterClass
public static void tearDownClass() {
} |
e5d7ee87-db32-4c6a-a1d1-8fda03fc1606 | 8 | private void setLeaf() throws Exception {
//this will fill the ranges array with the number of times
//each class type occurs for the instances.
//System.out.println("ihere");
if (m_training != null ) {
if (m_training.classAttribute().isNominal()) {
FastVector tmp;
//System.out.println("ehlpe");
m_ranges = new FastVector(1);
m_ranges.addElement(new FastVector(m_training.numClasses() + 1));
tmp = (FastVector)m_ranges.elementAt(0);
tmp.addElement(new Double(0));
for (int noa = 0; noa < m_training.numClasses(); noa++) {
tmp.addElement(new Double(0));
}
for (int noa = 0; noa < m_training.numInstances(); noa++) {
tmp.setElementAt(new Double(((Double)tmp.elementAt
((int)m_training.instance(noa).
classValue() + 1)).doubleValue() +
m_training.instance(noa).weight()),
(int)m_training.instance(noa).classValue() + 1);
//this gets the current class val and alters it and replaces it
}
}
else {
//then calc the standard deviation.
m_ranges = new FastVector(1);
double t1 = 0;
for (int noa = 0; noa < m_training.numInstances(); noa++) {
t1 += m_training.instance(noa).classValue();
}
if (m_training.numInstances() != 0) {
t1 /= m_training.numInstances();
}
double t2 = 0;
for (int noa = 0; noa < m_training.numInstances(); noa++) {
t2 += Math.pow(m_training.instance(noa).classValue() - t1, 2);
}
FastVector tmp;
if (m_training.numInstances() != 0) {
t1 = Math.sqrt(t2 / m_training.numInstances());
m_ranges.addElement(new FastVector(2));
tmp = (FastVector)m_ranges.elementAt(0);
tmp.addElement(new Double(0));
tmp.addElement(new Double(t1));
}
else {
m_ranges.addElement(new FastVector(2));
tmp = (FastVector)m_ranges.elementAt(0);
tmp.addElement(new Double(0));
tmp.addElement(new Double(Double.NaN));
}
}
}
} |
b6abf374-fc37-451b-a6bb-e241fee749de | 2 | public TD01Knapsack(int capacity, int w[], int v[])
{
int n = w.length;
// capacity ranges from 0 to 'capacity'
vKnapsack = new int[capacity + 1];
contentsKnapsack = new String[capacity + 1];
for (int i = 0; i <= capacity; i++)
{
vKnapsack[i] = Integer.MIN_VALUE;
contentsKnapsack[i] = "";
}
vKnapsack[0] = 0; // base case : knapsack of capacity 0 has no value
// initially there are no items in the knapsack
inKnapsack = new boolean[n];
for (int i = 0; i < n; i++)
inKnapsack[i] = false;
knapsack(n, capacity, w, v);
} |
b44249c1-3ba3-4b9e-b5da-081d309099a1 | 4 | void calculateShipPosition(){
this.shipCoordinates[0][0] = this.shipPosition_x;
this.shipCoordinates[0][1] = this.shipPosition_y;
/*For vertical ships*/
if(this.shipOrientation == 'v' || this.shipOrientation == 'V'){
for(byte x = 1; x < this.shipSize; x++){
this.shipCoordinates[x][0] = this.shipPosition_x;
this.shipCoordinates[x][1] = this.shipCoordinates[x-1][1] + 1;
}
/*For horizontal ships*/
} else {
for(byte x = 1; x < this.shipSize; x++){
this.shipCoordinates[x][0] = this.shipCoordinates[x-1][0] + 1;
this.shipCoordinates[x][1] = this.shipPosition_y;
}
}
} |
7d69694e-59cf-44b0-a5a2-1d40b74e582b | 8 | private void interpolatePrecisely(int iLower, int iUpper) {
int dx = (int) Math.floor(txRaster[iUpper]) - (int) Math.floor(txRaster[iLower]);
if (dx < 0)
dx = -dx;
float dy = (int) Math.floor(tyRaster[iUpper]) - (int) Math.floor(tyRaster[iLower]);
if (dy < 0)
dy = -dy;
if ((dx + dy) <= 1)
return;
float tLower = tRaster[iLower];
float tUpper = tRaster[iUpper];
int iMid = allocRaster(true);
for (int j = 4; --j >= 0;) {
float tMid = (tLower + tUpper) / 2;
calcRotatedPoint(tMid, iMid, true);
if (((int) Math.floor(txRaster[iMid]) == (int) Math.floor(txRaster[iLower]))
&& ((int) Math.floor(tyRaster[iMid]) == (int) Math.floor(tyRaster[iLower]))) {
fp8IntensityUp[iLower] = (fp8IntensityUp[iLower] + fp8IntensityUp[iMid]) / 2;
tLower = tMid;
}
else if (((int) Math.floor(txRaster[iMid]) == (int) Math.floor(txRaster[iUpper]))
&& ((int) Math.floor(tyRaster[iMid]) == (int) Math.floor(tyRaster[iUpper]))) {
fp8IntensityUp[iUpper] = (fp8IntensityUp[iUpper] + fp8IntensityUp[iMid]) / 2;
tUpper = tMid;
}
else {
interpolatePrecisely(iLower, iMid);
interpolatePrecisely(iMid, iUpper);
return;
}
}
txRaster[iMid] = txRaster[iLower];
tyRaster[iMid] = tyRaster[iUpper];
} |
79ada500-403d-4e5a-a3f8-a732caf2f05e | 0 | private void jButtonDetailsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDetailsActionPerformed
ctrlCR.DetailsPraticien();
}//GEN-LAST:event_jButtonDetailsActionPerformed |
3df9b1bf-28dd-4474-976a-08df8e06279f | 0 | public JLabel getjLabelAdresse() {
return jLabelAdresse;
} |
ff7dbfe8-6c65-4ce4-94c9-242c4f54debe | 2 | public int maxSubArray(int[] A) {// O(n) space
if (A == null)
return 0;
int[] buffer = new int[A.length];
buffer[0] = A[0];
int max = buffer[0];
for (int i = 1; i < A.length; i++) {
buffer[i] = Math.max(A[i], buffer[i - 1] + A[i]);
max = Math.max(buffer[i], max); // keep track of the largest sum
}
return max;
} |
44d101c1-f88d-414e-8bdf-b23c8b0db3ca | 0 | private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseClicked
jTextPane1.insertIcon(new ImageIcon(getClass().getResource("/picture/2.jpg")));
pos.add(jTextPane1.getText().toString().length()-1);
pic.add("}");
}//GEN-LAST:event_jLabel3MouseClicked |
3ce82803-ff70-4031-860f-b9bb5a2cec9b | 9 | @Override
public void process(SimEvent event) {
NodeReachedEvent _event = (NodeReachedEvent) event;
this.setPosition(_event.getPosition()); //Sets the actual position to the one provided by the event.
System.out.println(getName() + "@" + getEngine().getCurrentTime() + ": reached node (" + getPosition().getX() + "," + getPosition().getY() + ")");
getLog().addNode(getPosition(), getEngine().getCurrentTime()); // Save the reached Node to the log.
if(getLabyrinth().isEndpoint(getPosition())){
System.out.println(getName() + ": finished");
getEngine().stop();
}
else{
switch(_mode){
case search:
if(getLabyrinth().isWallAhead(getPosition(), getDirection())){ // The agent found a wall
this._mode = eMode.follow;
System.out.println(getName() + "@" + getEngine().getCurrentTime() + ": entered follow mode");
int _newDirection = getDirection();
do{ //The agent turns left until the wall is to it's right.
_newDirection -= 90;
if(_newDirection < 0){
_newDirection += 360;
}
}
while(getLabyrinth().isWallAhead(getPosition(), _newDirection));
setDirection(_newDirection);
NodeReachedEvent _newEvent = new NodeReachedEvent(getLabyrinth().getNodeAhead(getPosition(), getDirection()), getEngine().getCurrentTime() + getTicksPerLength(), 1, this);
getEngine().insertEvent(_newEvent);
}
else{ // The agent travels forward
NodeReachedEvent _newEvent = new NodeReachedEvent(getLabyrinth().getNodeAhead(getPosition(), getDirection()), getEngine().getCurrentTime() + getTicksPerLength(), 1, this);
getEngine().insertEvent(_newEvent);
}
break;
case follow:
if(getLabyrinth().isWallAhead(getPosition(), (getDirection()+90))){ // The agent has a wall to it's right
int _newDirection = getDirection();
while(getLabyrinth().isWallAhead(getPosition(), _newDirection)){ // The agent turns left, if it has a wall in front.
_newDirection -= 90;
if(_newDirection < 0){
_newDirection += 360;
}
}
setDirection(_newDirection);
NodeReachedEvent _newEvent = new NodeReachedEvent(getLabyrinth().getNodeAhead(getPosition(), getDirection()), getEngine().getCurrentTime() + getTicksPerLength(), 1, this);
getEngine().insertEvent(_newEvent);
}
else{ // The Agent has no wall to it's right. So it has to turn right to follow it.
setDirection(getDirection() + 90);
NodeReachedEvent _newEvent = new NodeReachedEvent(getLabyrinth().getNodeAhead(getPosition(), getDirection()), getEngine().getCurrentTime() + getTicksPerLength(), 1, this);
getEngine().insertEvent(_newEvent);
}
break;
}
}
} |
c591f73b-b0e1-4586-8918-e70cdaa6c0b4 | 4 | public boolean updatePosition(float pf_width, float pf_height, Player player, Vector<Brick> bricks, Vector<BrickConfiguration> brickConfigurations, BreakoutCanvas canvas) {
/*Update the shot's position*/
x += xVel;//(speed * xDir);
y += yVel;//(speed * yDir);
int score_sum = 0;
boolean bricksStillInPlay = false;
/*Resolve any potential collision between the shot and the level's bricks*/
for(Brick brick : bricks) {
if(brick.getIsAlive()) {//Only check bricks that are alive
score_sum += resolveCollision(brick);
brick.updateBrickColor(brickConfigurations);
bricksStillInPlay = true;
}
}
/*If no bricks are still in play has the player completed the level*/
if(!bricksStillInPlay) {
player.setLevelCompleted(true);
}
/*Add the points gained from hitting bricks*/
player.addPoints(score_sum);
//The shot has hit something and should be removed
if(!isAlive)
{
return true;
}
/*Check if the shot has moved outside the canvas*/
return maintainBounderies(pf_width, pf_height);
} |
eee968af-db39-4a70-870e-fd1d5d5b44b8 | 3 | public int maxProfit(int[] prices) {
int[] A = prices;
if (A.length < 2)
return 0;
int max = 0;
for (int i = 1; i < A.length; i++) {
int diff = A[i] - A[i - 1];
max = diff > 0 ? max + diff : max;
}
return max;
} |
a082af74-c8ac-4eac-b82b-56f03ac1c711 | 0 | public List findByRecordCode(Object recordCode) {
return findByProperty(RECORD_CODE, recordCode);
} |
4ff72e5e-97ca-473d-9676-94276698f748 | 0 | public void increment() {
System.out.println("Other increment operation");
} |
3c07b548-8a2d-41fd-90a5-ed5a713cfb8d | 6 | public static String generateTripKML(LinkedList<Trip> trips) {
String output;
output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n"
+ " <Document>\n" + " <name>Paths</name>\n"
+ " <Style id=\"testStyle\">\n" + " <LineStyle>\n"
+ " <color>80"
+ trips.getFirst().getRoute().get_route_color() + "</color>\n"
+ " <width>4</width>\n" + " </LineStyle>\n"
+ " </Style>\n";
int lastStopID = -1;
ArrayList<Vertex> points = new ArrayList<>();
for (Trip t : trips) {
for (StopAdapter s : t.getStops()) {
if (s.getStop().getID() == lastStopID) {
continue;
}
lastStopID = s.getStop().getID();
String time = "";
if (!"".equals(s.getStopTime().get_arrival_time())) {
time = "(" + s.getStopTime().get_arrival_time() + ")";
}
output += "<Placemark>\n" + " <name>"
+ s.getStop().get_stop_name().replaceAll("&", "&")
+ " " + time + "</name>\n" + " <description>"
+ s.getStop().get_stop_desc().replaceAll("&", "&")
+ "</description>\n" + " <Point>\n"
+ " <coordinates>" + s.getStop().get_stop_lon()
+ "," + s.getStop().get_stop_lat()
+ ",0</coordinates>\n" + " </Point>\n"
+ " </Placemark>\n";
}
points.addAll(t.getVertices());
}
output += " <Placemark>\n"
+ " <styleUrl>#testStyle</styleUrl>\n"
+ " <name>SoPo Bus Test</name>\n"
+ " <LineString id=\"route path\">\n"
+ " <extrude>1</extrude>\n" + " <coordinates>\n";
Vertex lastPoint = new Vertex();
for (int i = 0; i < points.size(); i++) {
if (points.get(i).getDistance(lastPoint) == 0.0) {
continue;
}
lastPoint = points.get(i);
output += points.get(i).toKMLLine();
}
output += " </coordinates>\n" + " </LineString>\n"
+ " </Placemark>\n";
// footer
output += " </Document>\n" + "</kml>";
return output;
} |
f76d0830-8d2d-4038-84ff-0d9dd344c031 | 0 | public String getSource() {
return this.source;
} |
e9c266e7-3fad-412c-8b06-15e4559411df | 4 | private void clearPosition() {
StreamsterApiInterfaceProxy proxy = new StreamsterApiInterfaceProxy();
Position[] positions = new Position[0];
try {
positions = proxy.getPositions();
} catch (RemoteException ex) {
Logger.getLogger(JobTradeUpGBPJPY.class.getName()).log(Level.SEVERE, null, ex);
}
int buyNum = 0;
for (Position position : positions) {
if (position.getStatus().equalsIgnoreCase("OPEN")) {
buyNum++;
}
}
if (buyNum == 0) {
buyState = false;
}
} |
728e0a4b-e12e-4be3-ab52-6f5c01afb25e | 0 | public boolean getHasVisited() {
return hasVisited;
} |
43659784-8291-4000-97f5-7e111ed994df | 7 | public void connect_event ()
{
boolean err = false;
SocketChannel fd = null;
try {
fd = connect ();
} catch (ConnectException e) {
err = true;
} catch (SocketException e) {
err = true;
} catch (SocketTimeoutException e) {
err = true;
} catch (IOException e) {
throw new ZError.IOException(e);
}
io_object.rm_fd (handle);
handle_valid = false;
if (err) {
// Handle the error condition by attempt to reconnect.
close ();
add_reconnect_timer();
return;
}
handle = null;
try {
Utils.tune_tcp_socket (fd);
Utils.tune_tcp_keepalives (fd, options.tcp_keepalive, options.tcp_keepalive_cnt, options.tcp_keepalive_idle, options.tcp_keepalive_intvl);
} catch (SocketException e) {
throw new RuntimeException(e);
}
// Create the engine object for this connection.
StreamEngine engine = null;
try {
engine = new StreamEngine (fd, options, endpoint);
} catch (ZError.InstantiationException e) {
socket.event_connect_delayed (endpoint, ZError.errno());
return;
}
// Attach the engine to the corresponding session object.
send_attach (session, engine);
// Shut the connecter down.
terminate ();
socket.event_connected (endpoint, fd);
} |
d464f041-2bd5-4407-a039-0fd6dfee4384 | 0 | public String getAlgorithm() {
return algorithm;
} |
56321e37-9f25-4a15-a62d-9e59cdab9980 | 7 | private String getLANIpAddress() {
// returns IP address in wifi network
try {
boolean firstAddress = true;
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface
.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface networkInterface = networkInterfaces
.nextElement();
// filters out 127.0.0.1 and inactive interfaces
if (networkInterface.isLoopback() || !networkInterface.isUp())
continue;
Enumeration<InetAddress> addresses = networkInterface
.getInetAddresses();
while (addresses.hasMoreElements()) {
InetAddress ipAddress = addresses.nextElement();
if (ipAddress.getHostAddress().contains(".")) {
if (firstAddress) {
firstAddress = false;
} else
return ipAddress.getHostAddress();
}
}
}
} catch (SocketException e) {
logExceptionMessage(e);
}
return OFFLINE;
} |
72a8fb40-7dc1-4cce-8b20-1391aae7f643 | 9 | @Override
public Screen respondToUserInput(KeyEvent key) {
int k = key.getKeyCode();
if (k == KeyEvent.VK_ESCAPE)
return game;
else if (k == KeyEvent.VK_DOWN || k == KeyEvent.VK_J || k == KeyEvent.VK_NUMPAD2) {
if (pos<8)
pos++;
} else if (k == KeyEvent.VK_UP || k == KeyEvent.VK_K || k == KeyEvent.VK_NUMPAD8) {
if (pos>0)
pos--;
}
return this;
} |
41cbbb33-26ef-4fcf-b4a5-df98aad8e0dd | 3 | public void insertStudent(String Name,String Address) throws SQLException {
String insertTableSQL = "INSERT INTO school.student "
+ "(name, address) " + "VALUES"
+ "('"+Name+"','"+Address+"')";
try {
MyConnection mc=new MyConnection();
dbConnection=mc.getConnection();
statement = dbConnection.createStatement();
//System.err.println(insertTableSQL);
// execute insert SQL stetement
statement.executeUpdate(insertTableSQL);
System.out.println("Record is inserted into Student table!");
} catch (SQLException e) {
System.out.println(e.getMessage());
} finally {
if (statement != null) {
statement.close();
}
if (dbConnection != null) {
dbConnection.close();
}
}
} |
b33092e5-2680-4f2a-9665-54bd6f5858c9 | 2 | public Collection<V> values() {
List<V> values = new ArrayList<>();
for(Set<V> valueSet : mValuesByKey.values()) {
for(V value : valueSet) {
values.add(value);
}
}
return values;
} |
b2612c48-04a1-4b39-b899-7b947b3247ea | 2 | @Override
public int compareTo(letterAndFrequency o) {
// TODO Auto-generated method stub
if(this.frequency < o.frequency){
return -1;
}
else if(this.frequency == o.frequency){
return 1;
}
return 0;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.