method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
83aeb3db-3ba6-4ca3-a3c7-332ecdb85659 | 5 | private static void skipWhitespace() {
char ch=lookChar();
while (ch != EOF && Character.isWhitespace(ch)) {
readChar();
if (ch == '\n' && readingStandardInput && writingStandardOutput) {
out.print("? ");
out.flush();
}
ch = lookChar();
}
... |
77956ee6-3fae-42e7-bd3e-4a1b2508e8c8 | 6 | synchronized void changeMap(int intLocX, int intLocY, short value)
{
if (value < 0 || value > vctTiles.size())
{
log.printMessage(Log.INFO, "Invalid value passed to changeMap("+intLocX+","+intLocY+","+value+")");
return;
}
if (intLocX < 0 || intLocX > MapColumns || intLocY < 0 || intLocY > MapRows)
{
... |
51978b92-e060-4f1c-a69c-b47b7a8169ee | 9 | public void mark(int[][] matrix, int x, int y) {
int n = matrix.length - 1;
int row = x; int col = y;
for(int i = 0; i <= n; ++i){
matrix[x][i] = 2;
matrix[i][y] = 2;
}
while(row <= n && col <= n){
matrix[row++][col++] = 2;
}
row = x; col = y;
while(row >= 0 && col >= 0){
matrix[row--][col... |
8a7ab63b-d88a-4ccc-8c80-043666819ae4 | 8 | public String getInnerClassString(ClassInfo info, int scopeType) {
InnerClassInfo[] outers = info.getOuterClasses();
if (outers == null)
return null;
for (int i = 0; i < outers.length; i++) {
if (outers[i].name == null || outers[i].outer == null)
return null;
Scope scope = getScope(ClassInfo.forName(... |
ee516dba-93ba-4576-8671-c4ce29fe3187 | 7 | @Override
public void update()
{
int xa = 0, ya = 0;
if (anim < 7500)
{
anim++;
} else
{
anim = 0;
}
if (input.up)
{
ya--;
}
if (input.down)
{
ya++;
}
if (input.left)
{
xa--;
}
if (input.right)
{
xa++;
}
if (xa != 0 || ya != 0)
{
move(xa, ya);
walking =... |
dd0936be-979b-4d81-9a0c-2c1604e05251 | 7 | public static double binomialCoefficientDouble(final int n, final int k) {
ArithmeticUtils.checkBinomial(n, k);
if ((n == k) || (k == 0)) {
return 1d;
}
if ((k == 1) || (k == n - 1)) {
return n;
}
if (k > n / 2) {
return binomialCoefficientDouble(n, n - k);
}
if (n < 67) {
return binomialCoe... |
3ade4b3c-812d-46ab-aa22-8b25fa9bdcb8 | 5 | public static void addPainters(final Paintable... painters) {
if (painters == null || getPaintHandler() == null) {
return;
}
for (final Paintable p : painters) {
if (p != null) {
if (p instanceof PaintTab) {
getMainPaint().add((PaintTab) p);
} else {
getPaintHandler().add(p);
}
}
... |
51a38078-01f0-4fd0-a37e-190198cd78bd | 7 | @Override
public final LinkedPointer addEffect(AbstractEffect<Boolean> e) {
if (e == null)
throw new NullPointerException("The effect is null.");
if (!e.affectTo().equals(type))
throw new NullPointerException("The effect cannot affect this property.");
lock();
... |
07ac6b20-e97a-4173-b432-a937ddc2f5ab | 0 | public void setClient(List<Client> client) {
this.client = client;
} |
5457c870-f911-4d63-80e5-16d56fb67cde | 9 | public boolean similar(Object other) {
try {
if (!(other instanceof JSONObject)) {
return false;
}
Set<String> set = this.keySet();
if (!set.equals(((JSONObject)other).keySet())) {
return false;
}
Iterator<St... |
09ed633b-b404-4202-bf9b-51c85dd3f421 | 3 | private void updateLink() {
try {
LinkListViewHelper helper = (LinkListViewHelper) updateLinkListComboBox.getSelectedItem();
if(helper == null)
return;
ElementListViewHelper to = (ElementListViewHelper) updateLinkToComboBox.getSelectedItem();
ElementListViewHelper from = (ElementListViewHelper) up... |
da261783-3867-487a-b0e8-b25ba72864b9 | 9 | private void restoreFullDescendantComponentStates(FacesContext facesContext,
Iterator<UIComponent> childIterator, Object state,
boolean restoreChildFacets)
{
Iterator<? extends Object[]> descendantStateIterator = null;
while (childIterator.hasNext())
{
if ... |
f60c6f53-1cfc-45c8-bf8f-f61508b96149 | 1 | public void addMaterial(String asId, String asName) {
if (this.getMaterials() == null) {
this.setMaterials(new Vector<MaterialAttr>());
}
this.getMaterials().add(new MaterialAttr(asId, asName));
} |
a4afa7f4-9579-45d7-b4d5-bf4b174eab81 | 3 | public static void sortCards(ArrayList<Card> cards, boolean ascending_descending, boolean value_suite) {
if (ascending_descending) {
sortAscending(cards, (value_suite) ? CardValueComparator : CardSuiteComparator);
}
else {
sortDescending(cards, (value_suite) ? CardValueCo... |
b1f5aee5-e938-4570-b479-01527dff52e6 | 8 | @Override
public String convertSelfToString() {
Integer lackLength;
String idStr = String.valueOf(id);
if(idStr.length() <= 6){
lackLength = 6 - idStr.length();
for(int i = 0; i < lackLength; i++){
idStr = "0" + idStr;
}
}
else{
idSt... |
5baf9240-1886-46ba-bd2e-fdfc3696380f | 2 | public static void main(String[] args)
{
long start = System.currentTimeMillis();
try
{
ObjectOutputStream outputStream =
new ObjectOutputStream(
new FileOutputStream("myBinaryIntegers.dat"));
for (int i = 1; i<=1000000; i++){
outputStream.writeInt(i);
}
System.out.print... |
9bfeef62-b9d5-49ff-9590-c3f06991c5cc | 6 | public static long getZobristKey(Board board) {
long zobristKey = 0L;
for (int index = 0; index < 120; index++) {
if ((index & 0x88) == 0) {
int piece = board.boardArray[index];
if (piece > 0) // White piece
{
zobristKey ^= PIECES[Math.abs(piece) - 1][0][index];
} else if (piece < 0) // Bl... |
b7749a8d-a0d2-4251-a782-a62bcefce884 | 6 | @Override
public Candidato alterar(IEntidade entidade) throws SQLException {
if (entidade instanceof Candidato) {
Candidato candidato = (Candidato) entidade;
PessoaDao pdao = new PessoaDao();
pdao.alterar(candidato);
String sql = "UPDATE candidato SET "
... |
e2daf5b9-3bcb-4630-8d89-f3495bbcbcac | 3 | public void create_table(String tableName, ArrayList<String> headers, ArrayList<Integer> types, ArrayList<Integer> sizes, ArrayList<Boolean> isNullAble, String objectIdColumnName) throws SeException{
_log.info("Create table ... "+tableName);
SeTable table = new SeTable(conn, (conn.getUser()+"."+tableName)); ... |
0c26fe7c-2294-4464-b785-deffade3ac10 | 9 | private static boolean stack_boolean(CallFrame frame, int i)
{
Object x = frame.stack[i];
if (x == Boolean.TRUE) {
return true;
} else if (x == Boolean.FALSE) {
return false;
} else if (x == UniqueTag.DOUBLE_MARK) {
double d = frame.sDbl[i];
... |
c02b84f7-9e11-4012-849c-dd5a276326d4 | 4 | LinkedList<Review> getReviews(String reviewer, String isbn, int amount) throws SQLException {
LinkedList<String> select = new LinkedList<String>();
select.add("*");
LinkedList<String> from = new LinkedList<String>();
from.add("Reviews");
LinkedList<Pair<String, String>> whereClau... |
e5b2c222-99ce-4de7-ae8b-8acea059c8c1 | 2 | public static double getMultiplier(){
double value = (targetFPS/currentFPS) * multiplier;
if(Double.isInfinite(value) || Double.isNaN(value)){
return 1;
}
return value;
} |
08624d2f-f9c1-4df4-846e-b1170183abbf | 2 | private static boolean isPrimitive(Class<?> c)
{
if (c.isPrimitive())
{
return true;
}
else
{
return primitives.contains(c);
}
} |
e485cc81-a886-4c63-8a98-d233f625601c | 9 | public boolean containsUnionThatContains( K key ) {
List<K> all = new ArrayList<K>();
for( Map.Entry<K, List<V>> e : mMap.entrySet() ) {
int c0 = mComp.compareMinToMax( key, e.getKey() );
int c1 = mComp.compareMinToMax( e.getKey(), key );
if( c0 < 0 && c1 < 0 ) {
... |
5dcc7a0d-0e6a-4a35-919d-5d48b135bba5 | 2 | public boolean CheckGameComplete() {
return (this.blackPieces==0 || this.whitePieces == 0)?true:false;
} |
3e53aaac-b497-4605-b96e-ea1bc51b606a | 1 | public JSONObject getJSONObject(String key) throws JSONException {
Object object = get(key);
if (object instanceof JSONObject) {
return (JSONObject)object;
}
throw new JSONException("JSONObject[" + quote(key) +
"] is not a JSONObject.");
} |
33a24e5a-7111-4d38-bab4-ba277644bcce | 7 | public double[] distributionForInstance (Instance instance) throws Exception {
if (!getDoNotReplaceMissingValues()) {
m_ReplaceMissingValues.input(instance);
m_ReplaceMissingValues.batchFinished();
instance = m_ReplaceMissingValues.output();
}
if (getConvertNominalToBinary()
&& ... |
088b2b4c-50cc-4f47-afbb-06054ee9dba6 | 9 | public void setup() {
if((MODUS & CODEX_MODE) == CODEX_MODE)
size((int) (displayWidth*(2/3f)),displayHeight,render);
else if((MODUS & PRESENT_MODE) == PRESENT_MODE)
size(displayWidth,displayHeight, render);
else
size(alternativeWidth,alternativeHeight, render);
if(render == P2D)
((PGraphics2D)g).tex... |
8a1a2bb6-79ad-410b-876d-808d89dec476 | 4 | public void holes_to_win(){
for (int i = 0; i < hoyde; i++) {
for (int j = 0; j < bredde; j++) {
if((map[i][j] == target) ||(map[i][j] == box_on_target)){
holes++;
}
}
}
} |
f5020b5a-4a72-4a16-b0bd-76f4d55f0569 | 8 | public void helper (String defName, SemanticAction node)
{
if( Compiler.extendedDebug ){
System.out.println( node.getName() );
}
if( node.getBranches().isEmpty() ){
if(node.getType() == SemanticAction.TYPE.INTEGER ||
node.getType() == SemanticAction.TYPE.BOOLEAN ){
return;
... |
ba378c3d-f93e-474e-8929-0cd1c60e47b1 | 7 | public static <E extends Comparable<E>> void sortWithQueue(Stack<E> stack) {
if(stack==null || stack.size()==0) {
return;
}
Queue<E> auxQueue = new LinkedList<E>();
while(!stack.isEmpty()) {
E item = stack.pop();
int auxQSize = auxQueue.size();
while(auxQSize>0 && auxQueue.peek().compareTo(it... |
39ddb2b4-c5e6-4618-a2ea-7fdd2da5aab7 | 3 | private boolean checkSingleRow(int z) {
for(int x = 0; x < length; x++) {
for(int y = 0; y < width; y++) {
if(cubes[x][y][z] == Piece.NOTHING)
return false;
}
}
return true;
} |
a12ba800-4e5b-428c-a68f-20b0a53d30de | 2 | private void initAllItems() {
allItems.clear();
// allItems.addAll(resource.findAllByGraph());
if (selectedSlot != null && selectedSlot.getSlotType() == ViewportSlotType.PRESENTATIONSTREAM) {
// final PresentationStream ps = controller.getPresentationStreamForViewport(viewport);
... |
db0208c0-92c0-4c9f-8442-cacfddc29eeb | 7 | @EventHandler
public void WitherConfusion(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Wither.Nause... |
bee2a00d-4d47-483d-82e8-47ace46bcff9 | 1 | public void setShutdownMenuFontstyle(Fontstyle fontstyle) {
if (fontstyle == null) {
this.shutdownMenuFontStyle = UIFontInits.SHDMENU.getStyle();
} else {
this.shutdownMenuFontStyle = fontstyle;
}
somethingChanged();
} |
6be63a89-57aa-49ad-b311-c88e5214236f | 4 | public void usingBang() {
visibleScreen.getSetup().getRound().getCheckerForPlayedCard().playingCard(visibleScreen.getIndex());
if (visibleScreen.getSetup().getRound().getCheckerForPlayedCard().checkBarrel()) {
if (visibleScreen.getSetup().getRound().getPlayerInTurn().getAvatar().toString(... |
69c26869-fe91-43b4-8f40-4916e30b2d0f | 3 | public void leaveChannel(ChatChannel channel, User user){
try {
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
String url = "jdbc:derby:" + DBName;
Connection connection = DriverManager.getConnection(url);
Statement statement = connection.createStatement();
String deleteStatement = "DELETE FROM... |
5131fb99-1aac-47c7-a63c-853fa31b1423 | 5 | public PrivateKey decodePrivateKey(byte[] k) {
// magic
if (k[0] != Registry.MAGIC_RAW_DSS_PRIVATE_KEY[0]
|| k[1] != Registry.MAGIC_RAW_DSS_PRIVATE_KEY[1]
|| k[2] != Registry.MAGIC_RAW_DSS_PRIVATE_KEY[2]
|| k[3] != Registry.MAGIC_RAW_DSS_PRIVATE_KEY[3]) {
throw n... |
4927be7f-3ec5-4864-85f4-6e90269806d3 | 0 | @Id
@Column(name = "percent")
public double getPercent() {
return percent;
} |
07f27d16-85a8-41d0-8cca-88298407555a | 7 | public static void main(String[] args) {
System.out.print("Enter size of grid: ");
int n = scanner.nextInt();
StdDraw.setScale(-n, n);
StdDraw.setPenRadius((0.9*size)/((double)n*2+1));
final int[] pos = {0,0};
while (true) {
System.out.println("Position = (" + pos[x] + "," + pos[y]+ ")");
if(M... |
9e3b375a-46e2-4c1a-b2e3-81b611d6a4f2 | 5 | @Override
public int decidePlay(int turn, int drawn, boolean fromDiscard){
//If it gives us a bad score, take from draw pile
if (!fromDiscard || cache_turn != turn){
cache_pos = findBestMove(turn, drawn);
//If it hurts our score, we'll discard
if (last_score.output <= base_score.output)
cache_pos = -1... |
9ad27a07-ea1e-4c51-b0b4-1d0f5283fc2c | 2 | public final List<Direction> getDirectionsToMoveTo(Element element) {
final List<Direction> directions = new ArrayList<Direction>();
for (Direction direction : Direction.values())
if (canMoveElement(element, direction))
directions.add(direction);
return directions;
} |
7ff49ba0-b7d1-4b20-8e02-f55131d1f3da | 2 | @Override
synchronized int vider() {
int compte = 0;
for (int i = 0; i < vehicules.length; i = i + 1) {
compte = compte + (vehicules[i] == null ? 0 : 1);
vehicules[i] = null;
}
return compte;
} |
e8ac06b7-5f40-40df-ad66-4a953949600c | 2 | private static Connection initConnection() {
Connection thisCon = null;
try {
Class.forName("com.mysql.jdbc.Driver");
thisCon = DriverManager.getConnection("jdbc:mysql://" + server, account ,password);
Statement stmt = thisCon.createStatement();
stmt.executeQuery("USE " + database);
} catch (SQLExcept... |
af47139c-f293-495a-a0e8-7c1153cff6bc | 0 | public void setAge(long age) {
this.age = age;
} |
bf20375c-bc02-4b36-9694-25a7aa72bb4a | 5 | public Edge getEdgeWithChunk(Chunk another){
for(Edge edge : this.edges){
if((edge.getIdA() == this.id && edge.getIdB() == another.getId())
|| (edge.getIdB() == this.id && edge.getIdA() == another.getId())){
return edge;
}
}
return null;
} |
d028f518-302c-4254-9a1e-42b836c603a9 | 6 | public static HashMap<String, HashMap<String, Integer>> getMap(String filePath) throws Exception
{
HashMap<String, HashMap<String, Integer>> map =
new HashMap<String, HashMap<String,Integer>>();
BufferedReader reader = filePath.toLowerCase().endsWith("gz") ?
new BufferedReader(new InputStreamReader(
... |
32581343-eb58-4b32-827c-12b4619a655c | 6 | public String retrieveXML(){
// create file chooser and ensure it displays in the center of the main window
JFileChooser xmlBrowser = new JFileChooser();
//sets xml filter
xmlBrowser.setFileFilter(new XMLFilter());
if(curDir!=null){
//if jFileChooser has been used before, load to previous directory
xm... |
427f04d2-ae66-4bf1-8eb8-342851e71714 | 4 | @EventHandler
public void onQuit(PlayerQuitEvent event)
{
Player player = event.getPlayer();
ItemStack[] inv = player.getInventory().getContents();
ItemStack[] armor = player.getInventory().getArmorContents();
ItemStack is;
for(int i = 0; i < inv.length; i++)
{
... |
b5931d6f-e6d3-400a-a461-63aabb41751d | 2 | @SuppressWarnings("unchecked")
public static float[] restore1D(String findFromFile) {
float[] dataSet = null;
try {
FileInputStream filein = new FileInputStream(findFromFile);
ObjectInputStream objin = new ObjectInputStream(filein);
try {
dataSet = (float[]) objin.readObject();
} catch (ClassCastEx... |
c04da70f-b81f-484f-9ff3-691e4f9f9e1c | 0 | private CategoryDataset getDataSet() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(2221, "14-2-4", "80");
dataset.addValue(3245, "14-2-5", "81");
dataset.addValue(5342, "14-2-6", "34");
dataset.addValue(7653, "14-2-7", "56");
return dat... |
36ab6cb1-08f1-4d4b-85f0-f20aed0841be | 9 | @Override
public void run() {
while (isRunning) {
try {
if (lcd instanceof LCDController)
((LCDController) lcd).aquireLock();
for (Button button : Button.values()) {
if (button.isButtonPressed(lcd.buttonsPressedBitmask())) {
if (buttonDownTimes[button.getPin()] != 0) {
... |
3a56ed8d-ebee-4548-a042-75d02fabb3ab | 0 | public int getRowCount() {
return variables.length;
} |
99a3a5fc-572c-4b9e-8688-47ed8b1a2795 | 8 | public void addNewOrder(UserType type, Order newOrder) throws DbException {
con = new Connector(DBCredentials.getInstance().getDBUserByType(type));
try {
con.startTransaction();
String sql = "INSERT INTO \"Orders\" (user_id, start_date, end_date) VALUES (?, ?, ?);";
... |
dd8c319f-2865-43e7-9c1d-6e260a256e87 | 1 | @Override
public RepairHandlePOA get() {
if (poa_ == null) {
poa_ = new DefaultRepairHandle(delegate_);
}
return poa_;
} |
4cedf175-e9d8-4860-bbd3-491e725504cd | 1 | @GET
@Path("/v2.0/networks")
@Produces({MediaType.APPLICATION_JSON, OpenstackNetProxyConstants.TYPE_RDF})
public Response listNetwork(@HeaderParam("Accept") String accept) throws MalformedURLException, IOException{
if (accept.equals(OpenstackNetProxyConstants.TYPE_RDF)){
String dataFromKB=NetworkOntology.listNe... |
c21b37e0-5c1b-4f16-8b41-14ba4832ae57 | 9 | public void actionPerformed(ActionEvent event) {
if(event.getActionCommand().equals(info.getActionCommand())){
new NodeInfoDialog(parent, node);
} else if(event.getActionCommand().equals(delete.getActionCommand())){
Runtime.removeNode(node);
parent.redrawGUI();
} else if(event.getActionCommand().equals(... |
27316f60-9816-43a3-be7a-9f43cf09b69e | 0 | public void setParent(ClusterNode parent) {
this.parent = parent;
} |
ee70b7ad-095b-4e3b-835e-f88b48938412 | 5 | @Override
public boolean equals(final Object o)
{
boolean isEqual = false;
if (o != null && getClass() == o.getClass())
{
final Human h = (Human)o;
isEqual = getName().equals(h.getName())
&& getSacks() == h.getSacks()
&& getHealth() == h.getHealth()
&& getStreng... |
21ad1c8b-99ed-48c1-9006-cd2e6ce3f1b0 | 9 | private int getNextStatesOfMaskByCharacter(int mask, Character ch) {
int nextMask = 0;
for (int i = 0; i < states.length; i++) {
if ((mask & pow[i]) != 0 && states[i] != null) {//mask contain state i
State state = states[i].getNextState(ch);
if (state != null)... |
81ed9b73-6cdf-4bd1-9e2c-c4e2d4d63334 | 6 | public List<String> validate(){
List<String> errors = new ArrayList<>();
if (!isValid(name, NAME_PATTERN)) {
errors.add("Name is not valid");
}
if (!isValid(lastName, NAME_PATTERN)) {
errors.add("Last Name is not valid");
}
if (!isValid(email, EMAIL_P... |
6eb2ec90-5297-4a65-8dc2-782743e77c16 | 9 | private String prepareTag(String tag) {
if (tag.length() == 0) {
throw new EmitterException("tag must not be empty");
}
if ("!".equals(tag)) {
return tag;
}
String handle = null;
String suffix = tag;
for (String prefix : tagPrefixes.keySet(... |
8caf05b6-b828-4238-9047-b728727669c0 | 2 | public void reset() {
Random random = new Random();
for (int i = 0; i < layers.length; i++)
{
int layerInputs = neuronCount;
if (i == 0)
{
layerInputs = inputCount;
}
layers[i] = new Neuron... |
6de0f9de-a686-4cc0-8608-edd0d867a9fa | 1 | private void startOutput(String fileName){
leavesNodeFile = new java.io.File(fileName + ".leavesNode.txt");
leavesContentFile = new java.io.File(fileName + ".leavesContent.txt");
try {
leavesNodeFileWriter = new FileWriter(leavesNodeFile);
leavesContentFileWriter = new FileWriter(leavesContentFile);
leav... |
d78373a9-2890-47df-817c-0becae576224 | 6 | public Deck()
{
// Generates ordered pair of 52 Cards
int cardValue;
int currHand;
int boundary;
for(int index = 3; index >= 0; index--)
{
currHand = 14;
boundary = 2;
while(currHand >= boundary)
{
... |
218a38c1-8d71-4cc5-b6c9-0303a7075183 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Rechnung)) {
return false;
}
Rechnung other = (Rechnung) object;
if ((this.id == null && other.id != null) || (... |
4a347077-7bff-4a1c-9cc5-994b92a97d23 | 4 | private static long ggT(long a, long b) {
while (true) {
if (a > b) {
a %= b;
if (a == 0)
return b;
} else {
b %= a;
if (b == 0)
return a;
}
}
} |
57903e65-ad9e-4e8e-b5a4-1e8ff1e746cd | 4 | public void propertyChange(PropertyChangeEvent e) {
boolean update = false;
String prop = e.getPropertyName();
//If the directory changed, don't show an image.
if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) {
file = null;
update = true;
//If a... |
66b4a733-747c-4f19-b924-f8ad57cf418f | 1 | public RegisteredListener[] getRegisteredListeners() {
RegisteredListener[] handlers;
while ((handlers = this.events) == null) bake(); // This prevents fringe cases of returning null
return handlers;
} |
f59e27aa-b677-4858-bcbc-7ce4e24bc2da | 7 | @Override
public final void tActionEvent(TActionEvent e)
{
Object eventSource = e.getSource();
if (eventSource == saveGenesButton)
{
Hub.geneIO.saveGenes(
new Genes(geneEditorField.getText(), seedSizeSlider.getValue(), (int) redLeafSlider.getValue(), (int) greenLeafSlider.getValue(), (i... |
30eaa3ab-1e56-446c-91db-92fb5ed67cc3 | 2 | private void displayAttacks(){
// this.jPanel1.setVisible(false);
// this.jPanel2.setVisible(true);
if (this.character.getAttacks() != null){
DefaultListModel listModel = new DefaultListModel();
for(Attack attack : this.character.getAttacks()){
... |
13024af4-b00a-4286-8864-4a3f00093276 | 9 | private void addInLines(StringBounder stringBounder, String s) {
if (maxMessageSize == 0) {
addSingleLine(s);
} else if (maxMessageSize > 0) {
final StringTokenizer st = new StringTokenizer(s, " ", true);
final StringBuilder currentLine = new StringBuilder();
while (st.hasMoreTokens()) {
final Strin... |
6da384d7-e662-4aa0-9fb5-babb6645b9f8 | 8 | public int getLandPrice(Tile tile) {
Player nationOwner = tile.getOwner();
int price = 0;
if (nationOwner == null || nationOwner == this) {
return 0; // Freely available
} else if (tile.getSettlement() != null) {
return -1; // Not for sale
} else if (nati... |
cc1bc75e-d5a7-43a5-9387-da232b45baa8 | 0 | public FrameWithPanel(String title)
{
super(title);
} |
ad886281-d6e3-4147-94f8-fa2616ae43b5 | 3 | public int calcTotal(){
int total = 0;
for(int i=1; i<=this.five; i++){
total+=5;
}
for(int i=1; i<=this.ten; i++){
total+=10;
}
for(int i=1; i<=this.twenty; i++){
total+=20;
}
return total;
} |
812fbc48-baa5-425e-8357-fbd1245c78fa | 7 | private boolean _decompose() {
double h[] = QH.data;
for( int k = 0; k < N-2; k++ ) {
// find the largest value in this column
// this is used to normalize the column and mitigate overflow/underflow
double max = 0;
for( int i = k+1; i < N; i++ ) {
... |
3b252680-c6c3-4517-a5a5-05444fa985c1 | 3 | static public void copyFile(String path, String filename, InputStream content) {
File file = new File("plugins" + path, filename);
try {
if(!file.exists()) {
File dir = new File("plugins/", path);
dir.mkdirs();
file.createNewFile();
}
OutputStream out = new FileOutputStream(file);
byte[] buf... |
5ee80534-7194-4e9b-a392-7d66a923f5c3 | 1 | public List<QuadTree> getRightNeighbors()
{
QuadTree sibling = this.getRightSibling();
if ( sibling == null ) return new ArrayList<QuadTree>();
return sibling.getLeftChildren();
} |
10a0aa70-ed3e-497a-bbd3-5be7094c53c0 | 4 | @Override
public void validarSemantica() {
Tipo condicion=null;
try {
condicion =expr1.validarSemantica();
} catch (Exception ex) {
Logger.getLogger(SentenciaWhile.class.getName()).log(Level.SEVERE, null, ex);
}
if(condicion instanceof TipoBooleano){
... |
6b0d3277-e604-431f-ab53-0205accbb468 | 4 | private boolean isValidField() {
if(getLogin().indexOf(' ') != -1 || getPassword().indexOf(' ') != -1 || getConfirmPassword().indexOf(' ') != -1) {
setMessage("Login and password can't contain spases.");
return false;
} else {
if(isValidPassword()) {
r... |
bbdf98de-691c-4307-8bb4-3105317bef53 | 5 | static final void method556(boolean bool) {
anInt8656++;
if (ObjectDefinition.loadingHandler != null)
ObjectDefinition.loadingHandler.method2319((byte) -75);
if (bool == false) {
if (Class348_Sub32.aThread6946 != null) {
for (;;) {
try {
Class348_Sub32.aThread6946.join();
break;
} catch... |
ba926cb0-69e4-4ce8-97eb-d364b0315746 | 5 | @Override
protected Object doProcessIncoming(Object o) throws FetionException {
// -_-!!! , 好吧,我承认这里判断逻辑有点乱。。
if (o instanceof SipcResponse) {
SipcResponse response = (SipcResponse) o;
// 先检查这个回复是不是分块回复的一部分
SliceSipcResponseHelper helper = this
.findSliceResponseHelper(response);
if (helper != nul... |
f21d87b2-7bdd-47eb-ab3b-83b42c3501e5 | 6 | public View create(Element elem) {
String kind = elem.getName();
if (kind != null)
if (kind.equals(AbstractDocument.ContentElementName)) {
return new LabelView(elem);
}
else if (kind.equals(AbstractDocument.ParagraphElementName)... |
e64b760f-9765-4780-a262-1c161a24d9c0 | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
2231c152-f5ef-4dc8-9b35-5cd90ec0634e | 1 | public void addElement(String key, String label)
{
if (!listLabel.containsKey(key)) {
listLabel.put(key, label);
listKey.add(key);
}
fireIntervalAdded(this, 0, listKey.size());
} |
04fa456d-7f57-4392-8e85-c3c01306ca65 | 8 | public void decode( ByteBuffer socketBuffer ) {
if( !socketBuffer.hasRemaining() || flushandclosestate )
return;
if( DEBUG )
System.out.println( "process(" + socketBuffer.remaining() + "): {" + ( socketBuffer.remaining() > 1000 ? "too big to display" : new String( socketBuffer.array(), socketBuffer.position(... |
8c48ae12-3fa7-4068-aef5-717610c2fa64 | 9 | public String toString(){
String result = new String();
if (getLeftChild() != null)
result += leftChild.toString();
if (getOp() != null)
switch(op){
case ADD:
result += "+";
break;
case SUBTRACT:
result += "-";
break;
case MULTIPLY:
result += "*";
break;
case DIVIDE:
... |
cd750c44-1701-4380-afb2-98d80291e2e5 | 0 | @Test
public void runTestReflection1() throws IOException {
InfoflowResults res = analyzeAPKFile("Reflection_Reflection1.apk");
Assert.assertEquals(1, res.size());
} |
7fc0bd0b-ab38-4557-9a62-32b5dc1e0c73 | 9 | public static boolean checkSOAP(SOAPMessage message, boolean printCert)
throws Exception {
boolean rez = false;
System.setProperty("com.ibm.security.enableCRLDP", "false");
// Add namespace declaration of the wsse
SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
... |
85d6da93-8eff-4833-bff0-ab5288d7189d | 8 | public void testDataDependance1() {
try {
int[] label = new int[0];
TreeNode result = contains(new TreeNode(label), mkChain(new int[][]{ label }));
assertTrue(null, "Failed to locate the only node of a leaf!",
result != null
&& result.getData(... |
fd711352-da4a-4538-b0f9-80187793b374 | 1 | private boolean jj_2_60(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_60(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(59, xla); }
} |
865fb2f9-6ba6-4028-938a-bf84c15343f1 | 5 | public void decryptFile(String filePath, byte[][][] reversedSubKeys) {
System.out.println();
System.out.println("Decrypting");
try {
final File inputFile = new File(filePath);
final File outputFile = new File(filePath.replace(".des",".decrypted"));
final Inpu... |
f8f313ba-794d-4fd1-ae33-f670008dccdf | 5 | private void voteButtonListener() {
viewRecipiesPanel.nickLabel1.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
currentRecipe.setVotes(1.0);
recipes.set(currentRecipePos, currentRecipe);
try {
Recipe.writeToFile(recipes);
} catch (ClassNotF... |
b34b8c13-e278-4ef3-ba43-59f47b3e3a98 | 1 | private boolean jj_2_80(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_80(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(79, xla); }
} |
e5aff85e-cbcd-4e58-afd9-d1d2cccf80ee | 4 | @Override
public Response performRequest(Request request) {
if (request.getParams().containsKey("Innermessage")) {
String inner = request.getParams().get("Innermessage").get(0);
if ("exit".equals(inner)) {
node.getHttpServer().stop(23);
... |
eee557d6-7b5e-4c73-8b5c-0b1985da4010 | 0 | public void setCtrCcResponsable(long ctrCcResponsable) {
this.ctrCcResponsable = ctrCcResponsable;
} |
fdadb48c-05a6-479c-9c36-b6d53b8ce389 | 0 | @Override
public void init(List<String> argumentList) {
operator = argumentList.get(0);
} |
9be0584a-cda9-47b4-92d7-d09b37aecf0a | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
965d7e57-051b-4f8a-bfdc-689994db3704 | 3 | public synchronized void update(long elapsedTime) {
if (frames.size() > 1) {
animTime += elapsedTime;
if (animTime >= totalDuration) {
animTime = animTime % totalDuration;
currFrameIndex = 0;
}
while (animTime > getFrame(currFrame... |
ba56ee7f-f84a-4513-bb66-32bcb281661b | 7 | private void doConstructParsingTable() {
//[TODO] construct parsing table
//for title use and $
LinkedList<String> pTableHeader = new LinkedList<String>();
LinkedList<NonTerminalValue> nt = new LinkedList<NonTerminalValue>();
pTableHeader.addAll(terminals);
pTableHeader.add("$");
nt.addAll(nonTerminals);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.